mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
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:
parent
14c37bf510
commit
88359b1ba5
@ -595,6 +595,15 @@ class DataObjectTest extends SapphireTest {
|
|||||||
'Position' => 'Varchar(100)'
|
'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 {
|
class DataObjectTest_SubTeam extends DataObjectTest_Team implements TestOnly {
|
||||||
static $db = array(
|
static $db = array(
|
||||||
'SubclassDatabaseField' => 'Text'
|
'SubclassDatabaseField' => 'Text'
|
||||||
|
Loading…
Reference in New Issue
Block a user