public function testAppendFieldRelationsLocationMappingWorks()
{
$locationHandler = $this->getPersistenceMock()->locationHandler();
$relationProcessor = $this->getPartlyMockedRelationProcessor();
$fieldValueMock = $this->getMockForAbstractClass('eZ\\Publish\\Core\\FieldType\\Value');
$fieldTypeMock = $this->getMock('eZ\\Publish\\SPI\\FieldType\\FieldType');
$fieldTypeMock->expects($this->once())->method('getRelations')->with($this->equalTo($fieldValueMock))->will($this->returnValue(array(Relation::FIELD => array(100), Relation::LINK => array('locationIds' => array(100), 'contentIds' => array(100)), Relation::EMBED => array('locationIds' => array(100), 'contentIds' => array(100)))));
$locationHandler->expects($this->once())->method('load')->with($this->equalTo(100))->will($this->returnValue(new Location(array('contentId' => 200))));
$relations = array();
$locationIdToContentIdMapping = array();
$relationProcessor->appendFieldRelations($relations, $locationIdToContentIdMapping, $fieldTypeMock, $fieldValueMock, 42);
$this->assertEquals(array(Relation::FIELD => array(42 => array(100 => 0)), Relation::LINK => array(100 => 0, 200 => true), Relation::EMBED => array(100 => 0, 200 => true)), $relations);
}