public function testInsertExistingFieldUpdating()
{
$versionInfo = new Content\VersionInfo();
$content = new Content();
$content->versionInfo = $versionInfo;
$value = new Content\FieldValue();
$field = new Field();
$field->id = 32;
$field->value = $value;
$this->getFieldValueConverterMock()->expects($this->exactly(2))->method('toStorageValue')->with($value, $this->isInstanceOf('eZ\\Publish\\Core\\Persistence\\Legacy\\Content\\StorageFieldValue'));
$this->getContentGatewayMock()->expects($this->once())->method('insertExistingField')->with($content, $field, $this->isInstanceOf('eZ\\Publish\\Core\\Persistence\\Legacy\\Content\\StorageFieldValue'));
$this->getContentStorageHandlerMock()->expects($this->once())->method('storeFieldData')->with($versionInfo, $field)->will($this->returnValue(true));
$this->getContentGatewayMock()->expects($this->once())->method('updateField')->with($field, $this->isInstanceOf('eZ\\Publish\\Core\\Persistence\\Legacy\\Content\\StorageFieldValue'));
$action = $this->getMockedAction();
$refAction = new ReflectionObject($action);
$refMethod = $refAction->getMethod('insertField');
$refMethod->setAccessible(true);
$fieldId = $refMethod->invoke($action, $content, $field);
$this->assertEquals(32, $fieldId);
$this->assertEquals(32, $field->id);
}