public function testDeleteContentThrowsUnauthorizedException() { $repository = $this->getRepositoryMock(); $contentService = $this->getPartlyMockedContentService(array('internalLoadContentInfo')); $contentInfo = $this->getMock('eZ\\Publish\\API\\Repository\\Values\\Content\\ContentInfo'); $contentInfo->expects($this->any())->method('__get')->with('id')->will($this->returnValue(42)); $contentService->expects($this->once())->method('internalLoadContentInfo')->with(42)->will($this->returnValue($contentInfo)); $repository->expects($this->once())->method('canUser')->with('content', 'remove')->will($this->returnValue(false)); /* @var \eZ\Publish\API\Repository\Values\Content\ContentInfo $contentInfo */ $contentService->deleteContent($contentInfo); }