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

assertUpdateFieldsWithNewLanguage() public method

public assertUpdateFieldsWithNewLanguage ( boolean $storageHandlerUpdatesFields = false )
$storageHandlerUpdatesFields boolean
    public function assertUpdateFieldsWithNewLanguage($storageHandlerUpdatesFields = false)
    {
        $contentGatewayMock = $this->getContentGatewayMock();
        $fieldTypeMock = $this->getFieldTypeMock();
        $storageHandlerMock = $this->getStorageHandlerMock();
        $fieldTypeMock->expects($this->exactly(1))->method('getEmptyValue')->will($this->returnValue(new FieldValue()));
        $contentGatewayMock->expects($this->exactly(3))->method('insertNewField')->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'));
        $callNo = 0;
        $fieldValue = new FieldValue();
        foreach (array(1, 2, 3) as $fieldDefinitionId) {
            $field = new Field(array('fieldDefinitionId' => $fieldDefinitionId, 'type' => 'some-type', 'versionNo' => 1, 'value' => $fieldValue, 'languageCode' => 'ger-DE'));
            // This field is copied from main language
            if ($fieldDefinitionId == 3) {
                $copyField = clone $field;
                $originalField = clone $field;
                $originalField->id = $fieldDefinitionId * 10 + 2;
                $originalField->languageCode = 'eng-GB';
                continue;
            }
            $storageHandlerMock->expects($this->at($callNo++))->method('storeFieldData')->with($this->isInstanceOf('eZ\\Publish\\SPI\\Persistence\\Content\\VersionInfo'), $this->equalTo($field))->will($this->returnValue($storageHandlerUpdatesFields));
        }
        /* @var $copyField */
        /* @var $originalField */
        $storageHandlerMock->expects($this->at($callNo))->method('copyFieldData')->with($this->isInstanceOf('eZ\\Publish\\SPI\\Persistence\\Content\\VersionInfo'), $this->equalTo($copyField), $this->equalTo($originalField))->will($this->returnValue($storageHandlerUpdatesFields));
    }