public function testLoadContentNotPublishedStatusUnauthorized() { $repository = $this->getRepositoryMock(); $contentService = $this->getPartlyMockedContentService(array('internalLoadContent')); $content = $this->getMock('eZ\\Publish\\API\\Repository\\Values\\Content\\Content'); $versionInfo = $this->getMockBuilder('eZ\\Publish\\API\\Repository\\Values\\Content\\VersionInfo')->setConstructorArgs(array(array('status' => APIVersionInfo::STATUS_DRAFT)))->getMockForAbstractClass(); $content->expects($this->once())->method('getVersionInfo')->will($this->returnValue($versionInfo)); $contentId = 123; $contentService->expects($this->once())->method('internalLoadContent')->with($contentId)->will($this->returnValue($content)); $repository->expects($this->exactly(2))->method('canUser')->will($this->returnValueMap(array(array('content', 'read', $content, null, true), array('content', 'versionread', $content, null, false)))); $contentService->loadContent($contentId); }