public function testSerializeFieldValueWithProcessor()
{
$serializer = $this->getFieldTypeSerializer();
$this->getGeneratorMock()->expects($this->once())->method('generateFieldTypeHash')->with($this->equalTo('fieldValue'), $this->equalTo(array('post-processed')));
$this->getContentTypeMock()->expects($this->once())->method('getFieldDefinition')->with($this->equalTo('some-field'))->will($this->returnValue(new FieldDefinition(array('fieldTypeIdentifier' => 'myFancyFieldType'))));
$processorMock = $this->getFieldTypeProcessorMock();
$this->getFieldTypeProcessorRegistryMock()->expects($this->once())->method('hasProcessor')->with('myFancyFieldType')->will($this->returnValue(true));
$this->getFieldTypeProcessorRegistryMock()->expects($this->once())->method('getProcessor')->with('myFancyFieldType')->will($this->returnCallback(function () use($processorMock) {
return $processorMock;
}));
$processorMock->expects($this->once())->method('postProcessValueHash')->with($this->equalTo(array(23, 42)))->will($this->returnValue(array('post-processed')));
$fieldTypeMock = $this->getFieldTypeMock();
$this->getFieldTypeServiceMock()->expects($this->once())->method('getFieldType')->with($this->equalTo('myFancyFieldType'))->will($this->returnCallback(function () use($fieldTypeMock) {
return $fieldTypeMock;
}));
$fieldTypeMock->expects($this->once())->method('getFieldTypeIdentifier')->will($this->returnValue('myFancyFieldType'));
$fieldTypeMock->expects($this->once())->method('toHash')->with($this->equalTo('my-field-value'))->will($this->returnValue(array(23, 42)));
$serializer->serializeFieldValue($this->getGeneratorMock(), $this->getContentTypeMock(), new Field(array('fieldDefIdentifier' => 'some-field', 'value' => 'my-field-value')));
}