eZ\Publish\Core\Persistence\Legacy\Tests\Content\ContentHandlerTest::testPublishFirstVersion PHP Метод

testPublishFirstVersion() публичный Метод

    public function testPublishFirstVersion()
    {
        $handler = $this->getPartlyMockedHandler(array('loadVersionInfo', 'setStatus'));
        $gatewayMock = $this->getGatewayMock();
        $mapperMock = $this->getMapperMock();
        $locationMock = $this->getLocationGatewayMock();
        $fieldHandlerMock = $this->getFieldHandlerMock();
        $metadataUpdateStruct = new MetadataUpdateStruct();
        $handler->expects($this->at(0))->method('loadVersionInfo')->with(23, 1)->will($this->returnValue(new VersionInfo(array('contentInfo' => new ContentInfo(array('currentVersionNo' => 1))))));
        $gatewayMock->expects($this->once())->method('load')->with($this->equalTo(23), $this->equalTo(1), $this->equalTo(null))->will($this->returnValue(array(42)));
        $gatewayMock->expects($this->once())->method('loadVersionedNameData')->with($this->equalTo(array(array('id' => 23, 'version' => 1))))->will($this->returnValue(array(22)));
        $mapperMock->expects($this->once())->method('extractContentFromRows')->with($this->equalTo(array(42)), $this->equalTo(array(22)))->will($this->returnValue(array($this->getContentFixtureForDraft())));
        $fieldHandlerMock->expects($this->once())->method('loadExternalFieldData')->with($this->isInstanceOf('eZ\\Publish\\SPI\\Persistence\\Content'));
        $gatewayMock->expects($this->once())->method('updateContent')->with(23, $metadataUpdateStruct);
        $locationMock->expects($this->once())->method('createLocationsFromNodeAssignments')->with(23, 1);
        $locationMock->expects($this->once())->method('updateLocationsContentVersionNo')->with(23, 1);
        $handler->expects($this->once())->method('setStatus')->with(23, VersionInfo::STATUS_PUBLISHED, 1);
        $handler->publish(23, 1, $metadataUpdateStruct);
    }