mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
MINOR Fixed broken DataExtensionTest
This commit is contained in:
parent
1683299d81
commit
a3e43171cf
@ -86,9 +86,9 @@ class DataExtensionTest extends SapphireTest {
|
|||||||
$player->setField('DateBirth', '1990-5-10');
|
$player->setField('DateBirth', '1990-5-10');
|
||||||
$player->Address = '123 somewhere street';
|
$player->Address = '123 somewhere street';
|
||||||
$player->write();
|
$player->write();
|
||||||
|
|
||||||
unset($player);
|
unset($player);
|
||||||
|
|
||||||
// Pull the record out of the DB and examine the extended fields
|
// Pull the record out of the DB and examine the extended fields
|
||||||
$player = DataObject::get_one('DataExtensionTest_Player', "\"Name\" = 'Joe'");
|
$player = DataObject::get_one('DataExtensionTest_Player', "\"Name\" = 'Joe'");
|
||||||
$this->assertEquals($player->DateBirth, '1990-05-10');
|
$this->assertEquals($player->DateBirth, '1990-05-10');
|
||||||
@ -181,16 +181,14 @@ class DataExtensionTest_PlayerExtension extends DataExtension implements TestOnl
|
|||||||
// Only add these extensions if the $class is set to DataExtensionTest_Player, to
|
// Only add these extensions if the $class is set to DataExtensionTest_Player, to
|
||||||
// test that the argument works.
|
// test that the argument works.
|
||||||
if($class == 'DataExtensionTest_Player') {
|
if($class == 'DataExtensionTest_Player') {
|
||||||
return array(
|
Config::inst()->update($class, 'db', array(
|
||||||
'db' => array(
|
'Address' => 'Text',
|
||||||
'Address' => 'Text',
|
'DateBirth' => 'Date',
|
||||||
'DateBirth' => 'Date',
|
'Status' => "Enum('Shooter,Goalie')"
|
||||||
'Status' => "Enum('Shooter,Goalie')"
|
));
|
||||||
),
|
Config::inst()->update($class, 'defaults', array(
|
||||||
'defaults' => array(
|
'Status' => 'Goalie'
|
||||||
'Status' => 'Goalie'
|
));
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -198,20 +196,21 @@ class DataExtensionTest_PlayerExtension extends DataExtension implements TestOnl
|
|||||||
|
|
||||||
class DataExtensionTest_ContactRole extends DataExtension implements TestOnly {
|
class DataExtensionTest_ContactRole extends DataExtension implements TestOnly {
|
||||||
|
|
||||||
public static $db =array(
|
public static $db = array(
|
||||||
'db' => array(
|
'Website' => 'Varchar',
|
||||||
'Website' => 'Varchar',
|
'Phone' => 'Varchar(255)',
|
||||||
'Phone' => 'Varchar(255)',
|
|
||||||
),
|
|
||||||
'has_many' => array(
|
|
||||||
'RelatedObjects' => 'DataExtensionTest_RelatedObject'
|
|
||||||
),
|
|
||||||
'defaults' => array(
|
|
||||||
'Phone' => '123'
|
|
||||||
),
|
|
||||||
'api_access' => true,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
public static $has_many = array(
|
||||||
|
'RelatedObjects' => 'DataExtensionTest_RelatedObject'
|
||||||
|
);
|
||||||
|
|
||||||
|
public static $defaults = array(
|
||||||
|
'Phone' => '123'
|
||||||
|
);
|
||||||
|
|
||||||
|
public static $api_access = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class DataExtensionTest_RelatedObject extends DataObject implements TestOnly {
|
class DataExtensionTest_RelatedObject extends DataObject implements TestOnly {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user