Phalcon\Test\Unit\Validation\Validator\UniquenessTest::testExceptMultipleFieldSingleExcept PHP Method

testExceptMultipleFieldSingleExcept() public method

Tests uniqueness validator with multiple field and single except
Since: 2016-06-05
Author: Wojciech Ĺšlawski ([email protected])
    public function testExceptMultipleFieldSingleExcept()
    {
        $this->specify('Test except option as combination of fields and single value in uniqueness validator.', function () {
            $validation = new Validation();
            $validation->add(['type', 'year'], new Uniqueness(['except' => ['type' => 'mechanical', 'year' => 1972]]));
            $messages = $validation->validate(null, $this->robot);
            expect($messages->count())->equals(0);
            $messages = $validation->validate(null, $this->anotherRobot);
            expect($messages->count())->equals(0);
        });
    }