eZ\Publish\Core\REST\Common\Tests\Input\FieldTypeParserTest::testParseValidatorConfigurationWithPreProcessing PHP Method

testParseValidatorConfigurationWithPreProcessing() public method

    public function testParseValidatorConfigurationWithPreProcessing()
    {
        $fieldTypeParser = $this->getFieldTypeParser();
        $this->fieldTypeProcessorRegistryMock->expects($this->once())->method('hasProcessor')->with($this->equalTo('some-fancy-field-type'))->will($this->returnValue(true));
        $processor = $this->fieldTypeProcessorMock;
        $this->fieldTypeProcessorRegistryMock->expects($this->once())->method('getProcessor')->with($this->equalTo('some-fancy-field-type'))->will($this->returnCallback(function () use($processor) {
            return $processor;
        }));
        $processor->expects($this->once())->method('preProcessValidatorConfigurationHash')->with(array(1, 2, 3))->will($this->returnValue(array(4, 5, 6)));
        $fieldTypeMock = $this->fieldTypeMock;
        $this->fieldTypeServiceMock->expects($this->once())->method('getFieldType')->with($this->equalTo('some-fancy-field-type'))->will($this->returnCallback(function () use($fieldTypeMock) {
            return $fieldTypeMock;
        }));
        $fieldTypeMock->expects($this->once())->method('validatorConfigurationFromHash')->with($this->equalTo(array(4, 5, 6)))->will($this->returnValue(array('foo', 'bar')));
        $this->assertEquals(array('foo', 'bar'), $fieldTypeParser->parseValidatorConfiguration('some-fancy-field-type', array(1, 2, 3)));
    }