eZ\Publish\Core\Persistence\Legacy\Tests\Content\FieldHandlerTest::assertCreateExistingFieldsInNewVersion PHP Method

assertCreateExistingFieldsInNewVersion() protected method

protected assertCreateExistingFieldsInNewVersion ( boolean $storageHandlerUpdatesFields = false )
$storageHandlerUpdatesFields boolean
    protected function assertCreateExistingFieldsInNewVersion($storageHandlerUpdatesFields = false)
    {
        $contentGatewayMock = $this->getContentGatewayMock();
        $storageHandlerMock = $this->getStorageHandlerMock();
        $contentGatewayMock->expects($this->exactly(6))->method('insertExistingField')->with($this->isInstanceOf('eZ\\Publish\\SPI\\Persistence\\Content'), $this->isInstanceOf('eZ\\Publish\\SPI\\Persistence\\Content\\Field'), $this->isInstanceOf('eZ\\Publish\\Core\\Persistence\\Legacy\\Content\\StorageFieldValue'))->will($this->returnValue(42));
        $callNo = 0;
        $fieldValue = new FieldValue();
        foreach (array(1, 2, 3) as $fieldDefinitionId) {
            foreach (array('eng-US', 'eng-GB') as $languageIndex => $languageCode) {
                $field = new Field(array('id' => $fieldDefinitionId * 10 + $languageIndex + 1, 'fieldDefinitionId' => $fieldDefinitionId, 'type' => 'some-type', 'value' => $fieldValue, 'languageCode' => $languageCode));
                $originalField = clone $field;
                $field->versionNo = 1;
                $storageHandlerMock->expects($this->at($callNo++))->method('copyFieldData')->with($this->isInstanceOf('eZ\\Publish\\SPI\\Persistence\\Content\\VersionInfo'), $this->equalTo($field), $this->equalTo($originalField))->will($this->returnValue($storageHandlerUpdatesFields));
            }
        }
    }