MINOR Added DataObjectTest->testPopulateDefaults()

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@73131 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2009-03-16 13:43:03 +00:00
parent 14c37bf510
commit 88359b1ba5

View File

@ -595,6 +595,15 @@ class DataObjectTest extends SapphireTest {
'Position' => 'Varchar(100)'
));
}
function testPopulateDefaults() {
$obj = new DataObjectTest_WithDefaults();
$this->assertEquals(
$obj->MyField,
"Default Value",
"Defaults are populated for in-memory object from \$defaults array"
);
}
}
@ -645,6 +654,16 @@ class DataObjectTest_FunnyFieldNames extends DataObject implements TestOnly {
);
}
class DataObjectTest_WithDefaults extends DataObject implements TestOnly {
static $db = array(
'MyField' => 'Text',
);
static $defaults = array(
'MyField' => 'Default Value',
);
}
class DataObjectTest_SubTeam extends DataObjectTest_Team implements TestOnly {
static $db = array(
'SubclassDatabaseField' => 'Text'