/** * Write a simple model class for a non aggregate root domain obbject * @test */ function relatedMethodsReflectRenamingAProperty() { $modelName = 'model7'; $this->generateInitialModelClassFile($modelName); // create an "old" domainObject $domainObject = $this->buildDomainObject($modelName); $this->assertTrue(is_object($domainObject), 'No domain object'); $property = new Tx_ExtensionBuilder_Domain_Model_DomainObject_StringProperty('prop1'); $uniqueIdentifier1 = md5(microtime() . 'prop1'); $property->setUniqueIdentifier($uniqueIdentifier1); $domainObject->addProperty($property); $uniqueIdentifier2 = md5(microtime() . 'model'); $domainObject->setUniqueIdentifier($uniqueIdentifier2); $this->roundTripService->_set('oldDomainObjects', array($domainObject->getUniqueIdentifier() => $domainObject)); // create an "old" class object. $modelClassObject = $this->classBuilder->generateModelClassObject($domainObject); $this->assertTrue(is_object($modelClassObject), 'No class object'); // Check that the getter/methods exist $this->assertTrue($modelClassObject->methodExists('getProp1')); $this->assertTrue($modelClassObject->methodExists('setProp1')); // set the class object manually, this is usually parsed from an existing class file $this->roundTripService->_set('classObject', $modelClassObject); // build a new domain object with the same unique identifiers $newDomainObject = $this->buildDomainObject('Dummy'); $property = new Tx_ExtensionBuilder_Domain_Model_DomainObject_BooleanProperty('newProp1Name'); $property->setUniqueIdentifier($uniqueIdentifier1); $property->setRequired(TRUE); $newDomainObject->addProperty($property); $newDomainObject->setUniqueIdentifier($uniqueIdentifier2); // now the slass object should be updated $this->roundTripService->_call('updateModelClassProperties', $domainObject, $newDomainObject); $classObject = $this->roundTripService->_get('classObject'); $this->assertTrue($classObject->methodExists('getNewProp1Name')); $this->assertTrue($classObject->methodExists('setNewProp1Name')); }