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

testDeleteVersion() public method

public testDeleteVersion ( )
    public function testDeleteVersion()
    {
        $handler = $this->getContentHandler();
        $gatewayMock = $this->getGatewayMock();
        $mapperMock = $this->getMapperMock();
        $locationHandlerMock = $this->getLocationGatewayMock();
        $fieldHandlerMock = $this->getFieldHandlerMock();
        // Load VersionInfo to delete fields
        $gatewayMock->expects($this->once())->method('loadVersionInfo')->with($this->equalTo(225), $this->equalTo(2))->will($this->returnValue(array(42)));
        $gatewayMock->expects($this->once())->method('loadVersionedNameData')->with($this->equalTo(array(array('id' => 225, 'version' => 2))))->will($this->returnValue(array(22)));
        $mapperMock->expects($this->once())->method('extractVersionInfoListFromRows')->with($this->equalTo(array(42)), $this->equalTo(array(22)))->will($this->returnValue(array(new VersionInfo())));
        $locationHandlerMock->expects($this->once())->method('deleteNodeAssignment')->with($this->equalTo(225), $this->equalTo(2));
        $fieldHandlerMock->expects($this->once())->method('deleteFields')->with($this->equalTo(225), $this->isInstanceOf('eZ\\Publish\\SPI\\Persistence\\Content\\VersionInfo'));
        $gatewayMock->expects($this->once())->method('deleteRelations')->with($this->equalTo(225), $this->equalTo(2));
        $gatewayMock->expects($this->once())->method('deleteVersions')->with($this->equalTo(225), $this->equalTo(2));
        $gatewayMock->expects($this->once())->method('deleteNames')->with($this->equalTo(225), $this->equalTo(2));
        $handler->deleteVersion(225, 2);
    }