private function generateRepositoryMockForContentTypeId($contentTypeId) { $parentContentInfo = $this->getContentInfoMock(array('contentTypeId' => $contentTypeId)); $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())); $repository = $this->getRepositoryMock(); $repository->expects($this->any())->method('getLocationService')->will($this->returnValue($locationServiceMock)); $repository->expects($this->any())->method('getPermissionResolver')->will($this->returnValue($this->getPermissionResolverMock())); return $repository; }