eZ\Publish\Core\Persistence\Legacy\Tests\Content\Type\ContentUpdater\Action\RemoveFieldTest::testApplyMultipleVersionsSingleTranslation PHP Method

testApplyMultipleVersionsSingleTranslation() public method

    public function testApplyMultipleVersionsSingleTranslation()
    {
        $contentId = 42;
        $versionNumbers = array(1, 2);
        $action = $this->getRemoveFieldAction();
        $content1 = $this->getContentFixture(1, array('cro-HR'));
        $content2 = $this->getContentFixture(2, array('cro-HR'));
        $this->getContentGatewayMock()->expects($this->once())->method('listVersionNumbers')->with($this->equalTo($contentId))->will($this->returnValue($versionNumbers));
        $this->getContentGatewayMock()->expects($this->once())->method('loadVersionedNameData')->with($this->equalTo(array(array('id' => $contentId, 'version' => 1), array('id' => $contentId, 'version' => 2))))->will($this->returnValue(array()));
        $this->getContentGatewayMock()->expects($this->at(2))->method('load')->with($contentId, 1)->will($this->returnValue(array()));
        $this->getContentMapperMock()->expects($this->at(0))->method('extractContentFromRows')->with(array(), array())->will($this->returnValue(array($content1)));
        $this->getContentGatewayMock()->expects($this->at(3))->method('load')->with($contentId, 2)->will($this->returnValue(array()));
        $this->getContentMapperMock()->expects($this->at(1))->method('extractContentFromRows')->with(array(), array())->will($this->returnValue(array($content2)));
        $this->getContentGatewayMock()->expects($this->once())->method('deleteField')->with($this->equalTo('3-cro-HR'));
        $this->getContentStorageHandlerMock()->expects($this->at(0))->method('deleteFieldData')->with($this->equalTo('ezstring'), $content1->versionInfo, $this->equalTo(array('3-cro-HR')));
        $this->getContentStorageHandlerMock()->expects($this->at(1))->method('deleteFieldData')->with($this->equalTo('ezstring'), $content2->versionInfo, $this->equalTo(array('3-cro-HR')));
        $action->apply($contentId);
    }