eZ\Publish\Core\Repository\Tests\Service\Mock\RelationProcessorTest::testAppendFieldRelations PHP Method

testAppendFieldRelations() public method

Test for the appendFieldRelations() method.
public testAppendFieldRelations ( array $fieldRelations, array $expected )
$fieldRelations array
$expected array
    public function testAppendFieldRelations(array $fieldRelations, array $expected)
    {
        $locationHandler = $this->getPersistenceMock()->locationHandler();
        $relationProcessor = $this->getPartlyMockedRelationProcessor();
        $fieldValueMock = $this->getMockForAbstractClass('eZ\\Publish\\Core\\FieldType\\Value');
        $fieldTypeMock = $this->getMock('eZ\\Publish\\SPI\\FieldType\\FieldType');
        $locationCallCount = 0;
        $fieldTypeMock->expects($this->once())->method('getRelations')->with($this->equalTo($fieldValueMock))->will($this->returnValue($fieldRelations));
        $this->assertLocationHandlerExpectation($locationHandler, $fieldRelations, Relation::LINK, $locationCallCount);
        $this->assertLocationHandlerExpectation($locationHandler, $fieldRelations, Relation::EMBED, $locationCallCount);
        $relations = array();
        $locationIdToContentIdMapping = array();
        $relationProcessor->appendFieldRelations($relations, $locationIdToContentIdMapping, $fieldTypeMock, $fieldValueMock, 42);
        $this->assertEquals($expected, $relations);
    }