/** * @test */ public function domainObjectHasExpectedRelations() { $name = 'MyDomainObject'; $description = 'My long domain object description'; $className = '\\TYPO3\\CMS\\Extbase\\Domain\\Model\\FrontendUser'; $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' => $className), 1 => array('relationName' => 'relation 2', 'relationType' => 'manyToMany', 'propertyIsExcludeField' => false, 'foreignRelationClass' => $className)))); $expected = new \EBT\ExtensionBuilder\Domain\Model\DomainObject(); $expected->setName($name); $expected->setDescription($description); $expected->setEntity(true); $expected->setAggregateRoot(true); $relation1 = new \EBT\ExtensionBuilder\Domain\Model\DomainObject\Relation\ManyToManyRelation('relation 1'); $relation1->setForeignClassName($className); $relation1->setRelatedToExternalModel(true); $relation1->setExcludeField(false); $relation1->setForeignDatabaseTableName('fe_users'); $relation2 = new \EBT\ExtensionBuilder\Domain\Model\DomainObject\Relation\ManyToManyRelation('relation 2'); $relation2->setForeignClassName($className); $relation2->setRelatedToExternalModel(true); $relation2->setExcludeField(false); $relation2->setForeignDatabaseTableName('fe_users'); $expected->addProperty($relation1); $expected->addProperty($relation2); $extbaseConfiguration = array('tableName' => 'fe_users'); $this->configurationManager->expects($this->atLeastOnce())->method('getExtbaseClassConfiguration')->with($className)->will($this->returnValue($extbaseConfiguration)); $actual = $this->objectSchemaBuilder->build($input); $this->assertEquals($actual, $expected, 'Domain Object not built correctly.'); }