public function testParseValueWithPreProcessing()
{
$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('preProcessValueHash')->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('fromHash')->with($this->equalTo(array(4, 5, 6)))->will($this->returnValue(array('foo', 'bar')));
$this->assertEquals(array('foo', 'bar'), $fieldTypeParser->parseValue('some-fancy-field-type', array(1, 2, 3)));
}