/** * @test */ public function domainObjectHasExpectedRelations() { $name = 'MyDomainObject'; $description = 'My long domain object description'; $input = array('name' => $name, 'objectsettings' => array('description' => $description, 'aggregateRoot' => TRUE, 'type' => 'Entity'), 'relationGroup' => array('relations' => array(0 => array('relationName' => 'relation 1', 'relationType' => 'manyToMany', 'propertyIsExcludeField' => FALSE, 'foreignRelationClass' => 'Tx_Extbase_Domain_Model_FrontendUser'), 1 => array('relationName' => 'relation 2', 'relationType' => 'manyToMany', 'propertyIsExcludeField' => FALSE, 'foreignRelationClass' => 'Tx_Extbase_Domain_Model_FrontendUser')))); $expected = new Tx_ExtensionBuilder_Domain_Model_DomainObject(); $expected->setName($name); $expected->setDescription($description); $expected->setEntity(TRUE); $expected->setAggregateRoot(TRUE); $relation1 = new Tx_ExtensionBuilder_Domain_Model_DomainObject_Relation_ManyToManyRelation('relation 1'); $relation1->setForeignClassName('Tx_Extbase_Domain_Model_FrontendUser'); $relation1->setRelatedToExternalModel(TRUE); $relation1->setExcludeField(FALSE); $relation1->setForeignDatabaseTableName('fe_users'); $relation2 = new Tx_ExtensionBuilder_Domain_Model_DomainObject_Relation_ManyToManyRelation('relation 2'); $relation2->setForeignClassName('Tx_Extbase_Domain_Model_FrontendUser'); $relation2->setRelatedToExternalModel(TRUE); $relation2->setExcludeField(FALSE); $relation2->setForeignDatabaseTableName('fe_users'); $expected->addProperty($relation1); $expected->addProperty($relation2); $actual = $this->objectSchemaBuilder->build($input); $this->assertEquals($actual, $expected, 'Domain Object not built correctly.'); }