eZ\Publish\Core\MVC\Symfony\Matcher\Tests\ContentBased\Matcher\Identifier\ParentContentTypeTest::generateRepositoryMockForContentTypeIdentifier PHP Method

generateRepositoryMockForContentTypeIdentifier() private method

Returns a Repository mock configured to return the appropriate Section object with given section identifier.
private generateRepositoryMockForContentTypeIdentifier ( string $contentTypeIdentifier ) : PHPUnit_Framework_MockObject_MockObject
$contentTypeIdentifier string
return PHPUnit_Framework_MockObject_MockObject
    private function generateRepositoryMockForContentTypeIdentifier($contentTypeIdentifier)
    {
        $parentContentInfo = $this->getContentInfoMock(array('contentTypeId' => 42));
        $parentLocation = $this->getLocationMock();
        $parentLocation->expects($this->once())->method('getContentInfo')->will($this->returnValue($parentContentInfo));
        $locationServiceMock = $this->getMockBuilder('eZ\\Publish\\API\\Repository\\LocationService')->disableOriginalConstructor()->getMock();
        $locationServiceMock->expects($this->atLeastOnce())->method('loadLocation')->will($this->returnValue($parentLocation));
        // The following is used in the case of a match by contentInfo
        $locationServiceMock->expects($this->any())->method('loadLocation')->will($this->returnValue($this->getLocationMock()));
        $contentTypeServiceMock = $this->getMockBuilder('eZ\\Publish\\API\\Repository\\ContentTypeService')->disableOriginalConstructor()->getMock();
        $contentTypeServiceMock->expects($this->once())->method('loadContentType')->with(42)->will($this->returnValue($this->getMockBuilder('eZ\\Publish\\API\\Repository\\Values\\ContentType\\ContentType')->setConstructorArgs(array(array('identifier' => $contentTypeIdentifier)))->getMockForAbstractClass()));
        $repository = $this->getRepositoryMock();
        $repository->expects($this->any())->method('getLocationService')->will($this->returnValue($locationServiceMock));
        $repository->expects($this->once())->method('getContentTypeService')->will($this->returnValue($contentTypeServiceMock));
        $repository->expects($this->any())->method('getPermissionResolver')->will($this->returnValue($this->getPermissionResolverMock()));
        return $repository;
    }