/** * Check that updates to a class fields are reflected in the database */ public function testFieldsRequestChanges() { $db = DB::getConn(); DB::quiet(); // Table will have been initially created by the $extraDataObjects setting // Let's insert a new field here $oldDB = DataObjectSchemaGenerationTest_DO::$db; DataObjectSchemaGenerationTest_DO::$db['SecretField'] = 'Varchar(100)'; // Verify that the above extra field triggered a schema update $db->beginSchemaUpdate(); $obj = new DataObjectSchemaGenerationTest_DO(); $obj->requireTable(); $needsUpdating = $db->doesSchemaNeedUpdating(); $db->cancelSchemaUpdate(); $this->assertTrue($needsUpdating); // Restore db configuration DataObjectSchemaGenerationTest_DO::$db = $oldDB; }