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

testMultipleFieldsConvert() public method

Tests uniqueness validator with multiple fields and a converted value
Since: 2016-07-25
Author: Bas Stottelaar ([email protected])
    public function testMultipleFieldsConvert()
    {
        $this->specify('Test uniqueness with combination of fields and a converted value.', function () {
            $validation = new Validation();
            $validation->add(['name', 'type'], new Uniqueness(['convert' => function (array $values) {
                $values['type'] = 'hydraulic';
                // mechanical -> hydraulic
                return $values;
            }]));
            $messages = $validation->validate(null, $this->robot);
            expect($messages->count())->equals(0);
        });
    }