public function testSerializeFieldSettingsWithPostProcessing() { $serializer = $this->getFieldTypeSerializer(); $fieldTypeMock = $this->getFieldTypeMock(); $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('postProcessFieldSettingsHash')->with($this->equalTo(array('foo' => 'bar')))->will($this->returnValue(array('post-processed'))); $this->getGeneratorMock()->expects($this->once())->method('generateFieldTypeHash')->with($this->equalTo('fieldSettings'), $this->equalTo(array('post-processed'))); $this->getFieldTypeServiceMock()->expects($this->once())->method('getFieldType')->with($this->equalTo('myFancyFieldType'))->will($this->returnCallback(function () use($fieldTypeMock) { return $fieldTypeMock; })); $fieldTypeMock->expects($this->once())->method('fieldSettingsToHash')->with($this->equalTo('my-field-settings'))->will($this->returnValue(array('foo' => 'bar'))); $serializer->serializeFieldSettings($this->getGeneratorMock(), 'myFancyFieldType', 'my-field-settings'); }