public function testAddFieldDefinition()
{
$mapperMock = $this->getMapperMock(array('toStorageFieldDefinition'));
$mapperMock->expects($this->once())->method('toStorageFieldDefinition')->with($this->isInstanceOf('eZ\\Publish\\SPI\\Persistence\\Content\\Type\\FieldDefinition'), $this->isInstanceOf('eZ\\Publish\\Core\\Persistence\\Legacy\\Content\\StorageFieldDefinition'));
$gatewayMock = $this->getGatewayMock();
$gatewayMock->expects($this->once())->method('insertFieldDefinition')->with($this->equalTo(23), $this->equalTo(1), $this->isInstanceOf('eZ\\Publish\\SPI\\Persistence\\Content\\Type\\FieldDefinition'), $this->isInstanceOf('eZ\\Publish\\Core\\Persistence\\Legacy\\Content\\StorageFieldDefinition'))->will($this->returnValue(42));
$fieldDef = new FieldDefinition();
$handler = $this->getHandler();
$handler->addFieldDefinition(23, 1, $fieldDef);
$this->assertEquals(42, $fieldDef->id);
}