Converts field definition data in $fieldDef into $storageFieldDef.
public toStorageFieldDefinition ( eZ\Publish\SPI\Persistence\Content\Type\FieldDefinition $fieldDef, |
||
$fieldDef | eZ\Publish\SPI\Persistence\Content\Type\FieldDefinition | |
$storageDef |
/** * @group fieldType * @group relationlist */ public function testToStorageFieldDefinition() { $fieldDefinition = new PersistenceFieldDefinition(array('fieldTypeConstraints' => new FieldTypeConstraints(array('fieldSettings' => array('selectionMethod' => Type::SELECTION_BROWSE, 'selectionDefaultLocation' => 12345, 'selectionContentTypes' => array("article", "blog_post")))))); $expectedStorageFieldDefinition = new StorageFieldDefinition(); $expectedStorageFieldDefinition->dataText5 = <<<EOT <?xml version="1.0" encoding="utf-8"?> <related-objects><constraints><allowed-class contentclass-identifier="article"/><allowed-class contentclass-identifier="blog_post"/></constraints><type value="2"/><object_class value=""/><selection_type value="0"/><contentobject-placement node-id="12345"/></related-objects> EOT; $actualStorageFieldDefinition = new StorageFieldDefinition(); $this->converter->toStorageFieldDefinition($fieldDefinition, $actualStorageFieldDefinition); $this->assertEquals($expectedStorageFieldDefinition, $actualStorageFieldDefinition); }