eZ\Publish\Core\Persistence\Legacy\Tests\Content\ContentHandlerTest::testCopySingleVersion PHP Method

testCopySingleVersion() public method

    public function testCopySingleVersion()
    {
        $handler = $this->getPartlyMockedHandler(array('load', 'internalCreate'));
        $gatewayMock = $this->getGatewayMock();
        $mapperMock = $this->getMapperMock();
        $handler->expects($this->once())->method('load')->with($this->equalTo(23), $this->equalTo(32))->will($this->returnValue(new Content()));
        $mapperMock->expects($this->once())->method('createCreateStructFromContent')->with($this->isInstanceOf('eZ\\Publish\\SPI\\Persistence\\Content'))->will($this->returnValue(new CreateStruct()));
        $handler->expects($this->once())->method('internalCreate')->with($this->isInstanceOf('eZ\\Publish\\SPI\\Persistence\\Content\\CreateStruct'), $this->equalTo(32))->will($this->returnValue(new Content(['versionInfo' => new VersionInfo(['contentInfo' => new ContentInfo(['id' => 24])])])));
        $gatewayMock->expects($this->once())->method('copyRelations')->with($this->equalTo(23), $this->equalTo(24), $this->equalTo(32))->will($this->returnValue(null));
        $result = $handler->copy(23, 32);
        $this->assertInstanceOf('eZ\\Publish\\SPI\\Persistence\\Content', $result);
    }