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

testInternalLoadContent() public method

public testInternalLoadContent ( $id, $languages, $versionNo, $isRemoteId, $useAlwaysAvailable )
    public function testInternalLoadContent($id, $languages, $versionNo, $isRemoteId, $useAlwaysAvailable)
    {
        $contentService = $this->getPartlyMockedContentService();
        /** @var \PHPUnit_Framework_MockObject_MockObject $contentHandler */
        $contentHandler = $this->getPersistenceMock()->contentHandler();
        $realVersionNo = $versionNo;
        $realId = $id;
        if ($isRemoteId) {
            $realVersionNo = $versionNo ?: 7;
            $realId = 123;
            $spiContentInfo = new SPIContentInfo(array('currentVersionNo' => $realVersionNo, 'id' => $realId));
            $contentHandler->expects($this->once())->method('loadContentInfoByRemoteId')->with($id)->will($this->returnValue($spiContentInfo));
        } elseif ($versionNo === null) {
            $realVersionNo = 7;
            $spiContentInfo = new SPIContentInfo(array('currentVersionNo' => $realVersionNo));
            $contentHandler->expects($this->once())->method('loadContentInfo')->with($id)->will($this->returnValue($spiContentInfo));
        } elseif (!empty($languages) && $useAlwaysAvailable) {
            $spiContentInfo = new SPIContentInfo(array('alwaysAvailable' => false));
            $contentHandler->expects($this->once())->method('loadContentInfo')->with($id)->will($this->returnValue($spiContentInfo));
        }
        $spiContent = new SPIContent();
        $contentHandler->expects($this->once())->method('load')->with($realId, $realVersionNo, $languages)->will($this->returnValue($spiContent));
        $content = $this->getMock('eZ\\Publish\\API\\Repository\\Values\\Content\\Content');
        $this->getDomainMapperMock()->expects($this->once())->method('buildContentDomainObject')->with($spiContent)->will($this->returnValue($content));
        $this->assertSame($content, $contentService->internalLoadContent($id, $languages, $versionNo, $isRemoteId, $useAlwaysAvailable));
    }
ContentTest