Phalcon\Test\Unit\ValidationTest::testWithEntityAndFilter PHP 메소드

testWithEntityAndFilter() 공개 메소드

Tests validate method with entity and filters
부터: 2016-09-26
저자: Wojciech Ślawski ([email protected])
    public function testWithEntityAndFilter()
    {
        $this->specify('Validation filters are not working with entity', function () {
            $users = new Users(['name' => ' ']);
            $messages = $this->validation->validate(null, $users);
            expect($messages->count())->equals(1);
            expect($messages->offsetGet(0)->getMessage())->equals('Name cant be empty.');
            $expectedMessages = Group::__set_state(['_messages' => [Message::__set_state(['_type' => 'PresenceOf', '_message' => 'Name cant be empty.', '_field' => 'name', '_code' => '0'])]]);
            expect($messages)->equals($expectedMessages);
        });
    }