Phalcon\Test\Unit\ValidationTest::testWithEntityAndFilter PHP Method

testWithEntityAndFilter() public method

Tests validate method with entity and filters
Since: 2016-09-26
Author: 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);
        });
    }