Permalink
Browse files

MINOR Fixed broken DataExtensionTest

  • Loading branch information...
1 parent 1683299 commit a3e43171cfcf81a0a8f197d245a14e5c8004e3bb @halkyon halkyon committed Apr 20, 2012
Showing with 23 additions and 24 deletions.
  1. +23 −24 tests/model/DataExtensionTest.php
@@ -86,9 +86,9 @@ function testAddExtensionLoadsStatics() {
$player->setField('DateBirth', '1990-5-10');
$player->Address = '123 somewhere street';
$player->write();
-
+
unset($player);
-
+
// Pull the record out of the DB and examine the extended fields
$player = DataObject::get_one('DataExtensionTest_Player', "\"Name\" = 'Joe'");
$this->assertEquals($player->DateBirth, '1990-05-10');
@@ -181,37 +181,36 @@ public static function add_to_class($class = null, $extensionClass = null, $args
// Only add these extensions if the $class is set to DataExtensionTest_Player, to
// test that the argument works.
if($class == 'DataExtensionTest_Player') {
- return array(
- 'db' => array(
- 'Address' => 'Text',
- 'DateBirth' => 'Date',
- 'Status' => "Enum('Shooter,Goalie')"
- ),
- 'defaults' => array(
- 'Status' => 'Goalie'
- )
- );
+ Config::inst()->update($class, 'db', array(
+ 'Address' => 'Text',
+ 'DateBirth' => 'Date',
+ 'Status' => "Enum('Shooter,Goalie')"
+ ));
+ Config::inst()->update($class, 'defaults', array(
+ 'Status' => 'Goalie'
+ ));
}
}
}
class DataExtensionTest_ContactRole extends DataExtension implements TestOnly {
- public static $db =array(
- 'db' => array(
- 'Website' => 'Varchar',
- 'Phone' => 'Varchar(255)',
- ),
- 'has_many' => array(
- 'RelatedObjects' => 'DataExtensionTest_RelatedObject'
- ),
- 'defaults' => array(
- 'Phone' => '123'
- ),
- 'api_access' => true,
+ public static $db = array(
+ 'Website' => 'Varchar',
+ 'Phone' => 'Varchar(255)',
);
+ 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 {

0 comments on commit a3e4317

Please sign in to comment.