eZ\Publish\Core\Repository\Tests\Service\Mock\RelationProcessorTest::testProcessFieldRelationsRemovesRelations PHP 메소드

testProcessFieldRelationsRemovesRelations() 공개 메소드

Test for the processFieldRelations() method.
    public function testProcessFieldRelationsRemovesRelations()
    {
        $relationProcessor = $this->getPartlyMockedRelationProcessor();
        $contentHandlerMock = $this->getPersistenceMockHandler('Content\\Handler');
        $contentTypeMock = $this->getMockForAbstractClass('eZ\\Publish\\API\\Repository\\Values\\ContentType\\ContentType');
        $existingRelations = array($this->getStubbedRelation(1, Relation::COMMON, null, 10), $this->getStubbedRelation(2, Relation::EMBED, null, 11), $this->getStubbedRelation(3, Relation::LINK, null, 12), $this->getStubbedRelation(4, Relation::FIELD, 42, 13), $this->getStubbedRelation(5, Relation::EMBED | Relation::COMMON, null, 14), $this->getStubbedRelation(6, Relation::LINK | Relation::COMMON, null, 15), $this->getStubbedRelation(7, Relation::EMBED | Relation::LINK, null, 16), $this->getStubbedRelation(8, Relation::EMBED | Relation::LINK | Relation::COMMON, null, 17));
        $inputRelations = array(Relation::EMBED => array_flip(array(11, 14, 17)), Relation::LINK => array_flip(array(12, 15, 17)));
        $contentHandlerMock->expects($this->never())->method('addRelation');
        $contentTypeMock->expects($this->once())->method('getFieldDefinition')->with($this->equalTo('identifier42'))->will($this->returnValue(new FieldDefinition(array('id' => 42))));
        $contentHandlerMock->expects($this->at(0))->method('removeRelation')->with($this->equalTo(7), $this->equalTo(Relation::EMBED));
        $contentHandlerMock->expects($this->at(1))->method('removeRelation')->with($this->equalTo(7), $this->equalTo(Relation::LINK));
        $contentHandlerMock->expects($this->at(2))->method('removeRelation')->with($this->equalTo(4), $this->equalTo(Relation::FIELD));
        $relationProcessor->processFieldRelations($inputRelations, 24, 2, $contentTypeMock, $existingRelations);
    }