silverstripe-framework/tests/model/DataObjectSchemaGenerationTest.php
Ingo Schommer 1997485ba3 BUGFIX #5009: Removed inappropriate field-detection change on multienums with no default (from r97980)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@102561 467b73ca-7a2a-4603-9d3b-597d59a354a9
2010-04-13 01:46:27 +00:00

40 lines
1.0 KiB
PHP

<?php
class DataObjectSchemaGenerationTest extends SapphireTest {
protected $extraDataObjects = array(
'DataObjectSchemaGenerationTest_DO',
);
/**
* Check that once a schema has been generated, then it doesn't need any more updating
*/
function testFieldsDontRerequestChanges() {
$db = DB::getConn();
DB::quiet();
// Table will have been initially created by the $extraDataObjects setting
// Verify that it doesn't need to be recreated
$db->beginSchemaUpdate();
$obj = new DataObjectSchemaGenerationTest_DO();
$obj->requireTable();
$needsUpdating = $db->doesSchemaNeedUpdating();
$db->cancelSchemaUpdate();
$this->assertFalse($needsUpdating);
}
}
class DataObjectSchemaGenerationTest_DO extends DataObject implements TestOnly {
static $db = array(
'MultiEnum1' => 'MultiEnum("A, B, C, D","")',
'MultiEnum2' => 'MultiEnum("A, B, C, D","A")',
'MultiEnum3' => 'MultiEnum("A, B, C, D","A, B")',
'Enum1' => 'Enum("A, B, C, D","")',
'Enum2' => 'Enum("A, B, C, D","A")',
);
}