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

testLoadVersionInfoByIdNonPublishedVersion() public method

Test for the loadVersionInfo() method.
    public function testLoadVersionInfoByIdNonPublishedVersion()
    {
        $repository = $this->getRepositoryMock();
        $contentServiceMock = $this->getPartlyMockedContentService();
        /** @var \PHPUnit_Framework_MockObject_MockObject $contentHandler */
        $contentHandler = $this->getPersistenceMock()->contentHandler();
        $domainMapperMock = $this->getDomainMapperMock();
        $versionInfoMock = $this->getMock('eZ\\Publish\\API\\Repository\\Values\\Content\\VersionInfo');
        $versionInfoMock->expects($this->any())->method('__get')->with('status')->will($this->returnValue(APIVersionInfo::STATUS_DRAFT));
        $contentHandler->expects($this->once())->method('loadVersionInfo')->with($this->equalTo(42), $this->equalTo(24))->will($this->returnValue(new SPIVersionInfo()));
        $domainMapperMock->expects($this->once())->method('buildVersionInfoDomainObject')->with(new SPIVersionInfo())->will($this->returnValue($versionInfoMock));
        $repository->expects($this->once())->method('canUser')->with($this->equalTo('content'), $this->equalTo('versionread'), $this->equalTo($versionInfoMock))->will($this->returnValue(true));
        $result = $contentServiceMock->loadVersionInfoById(42, 24);
        $this->assertEquals($versionInfoMock, $result);
    }
ContentTest