/** * @group fieldType * @group selection * @covers \eZ\Publish\Core\Persistence\Legacy\Content\FieldValue\Converter\Selection::toFieldDefinition */ public function testToFieldDefinitionSingleEmpty() { $storageFieldDefinition = new StorageFieldDefinition(); $storageFieldDefinition->dataInt1 = 0; $storageFieldDefinition->dataText5 = <<<EOT <?xml version="1.0" encoding="utf-8"?> <ezselection> <options> </options> </ezselection> EOT; $expectedFieldDefinition = new PersistenceFieldDefinition(array('fieldTypeConstraints' => new FieldTypeConstraints(array('fieldSettings' => new FieldSettings(array('isMultiple' => false, 'options' => array())))), 'defaultValue' => new FieldValue(array('data' => array())))); $actualFieldDefinition = new PersistenceFieldDefinition(); $this->converter->toFieldDefinition($storageFieldDefinition, $actualFieldDefinition); $this->assertEquals($expectedFieldDefinition, $actualFieldDefinition); }
/** * @group fieldType * @group relationlist */ public function testToFieldDefinitionMultiple() { $storageFieldDefinition = new StorageFieldDefinition(); $storageFieldDefinition->dataText5 = <<<EOT <?xml version="1.0" encoding="utf-8"?> <related-objects> <constraints> <allowed-class contentclass-identifier="forum"/> <allowed-class contentclass-identifier="folder"/> </constraints><type value="2"/> <object_class value=""/> <selection_type value="1"/> <contentobject-placement node-id="54321"/> </related-objects> EOT; $expectedFieldDefinition = new PersistenceFieldDefinition(array('fieldTypeConstraints' => new FieldTypeConstraints(array('fieldSettings' => array('selectionMethod' => Type::SELECTION_DROPDOWN, 'selectionDefaultLocation' => 54321, 'selectionContentTypes' => array("forum", "folder")))), 'defaultValue' => new FieldValue(array('data' => array('destinationContentIds' => array()))))); $actualFieldDefinition = new PersistenceFieldDefinition(); $this->converter->toFieldDefinition($storageFieldDefinition, $actualFieldDefinition); $this->assertEquals($expectedFieldDefinition, $actualFieldDefinition); }