public function testLoadVersionInfoById()
{
$repository = $this->getRepositoryMock();
$contentServiceMock = $this->getPartlyMockedContentService(array('loadContentInfo'));
/** @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_PUBLISHED));
$contentServiceMock->expects($this->once())->method('loadContentInfo')->with($this->equalTo(42))->will($this->returnValue(new ContentInfo(array('currentVersionNo' => 24))));
$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('read'), $this->equalTo($versionInfoMock))->will($this->returnValue(true));
$result = $contentServiceMock->loadVersionInfoById(42);
$this->assertEquals($versionInfoMock, $result);
}