eZ\Publish\Core\Repository\Tests\Service\Mock\ContentTest::testLoadContentNonPublished PHP Method

testLoadContentNonPublished() public method

    public function testLoadContentNonPublished()
    {
        $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, true))));
        $this->assertSame($content, $contentService->loadContent($contentId));
    }
ContentTest