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

assertCreateNewFieldsForMainLanguage() protected method

protected assertCreateNewFieldsForMainLanguage ( boolean $storageHandlerUpdatesFields = false )
$storageHandlerUpdatesFields boolean
    protected function assertCreateNewFieldsForMainLanguage($storageHandlerUpdatesFields = false)
    {
        $contentGatewayMock = $this->getContentGatewayMock();
        $fieldTypeMock = $this->getFieldTypeMock();
        $storageHandlerMock = $this->getStorageHandlerMock();
        $fieldTypeMock->expects($this->exactly(3))->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'))->will($this->returnValue(42));
        $callNo = 0;
        $fieldValue = new FieldValue();
        foreach (array(1, 2, 3) as $fieldDefinitionId) {
            $field = new Field(array('id' => 42, 'fieldDefinitionId' => $fieldDefinitionId, 'type' => 'some-type', 'versionNo' => 1, 'value' => $fieldValue, 'languageCode' => 'eng-GB'));
            $storageHandlerMock->expects($this->at($callNo++))->method('storeFieldData')->with($this->isInstanceOf('eZ\\Publish\\SPI\\Persistence\\Content\\VersionInfo'), $this->equalTo($field))->will($this->returnValue($storageHandlerUpdatesFields));
        }
    }