eZ\Publish\Core\Helper\Tests\PreviewLocationProviderTest::testGetPreviewLocationDraft PHP Method

testGetPreviewLocationDraft() public method

    public function testGetPreviewLocationDraft()
    {
        $contentId = 123;
        $parentLocationId = 456;
        $contentInfo = $this->getMockBuilder('eZ\\Publish\\API\\Repository\\Values\\Content\\ContentInfo')->setConstructorArgs(array(array('id' => $contentId)))->getMockForAbstractClass();
        $this->contentService->expects($this->once())->method('loadContentInfo')->with($contentId)->will($this->returnValue($contentInfo));
        $this->locationService->expects($this->never())->method('loadLocation');
        $this->locationHandler->expects($this->once())->method('loadParentLocationsForDraftContent')->with($contentId)->will($this->returnValue(array(new Location(array('id' => $parentLocationId)))));
        $location = $this->provider->loadMainLocation($contentId);
        $this->assertInstanceOf('eZ\\Publish\\API\\Repository\\Values\\Content\\Location', $location);
        $this->assertSame($contentInfo, $location->contentInfo);
        $this->assertNull($location->id);
        $this->assertEquals($parentLocationId, $location->parentLocationId);
    }