Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

MINOR Fixed broken DataExtensionTest

  • Loading branch information...
commit a3e43171cfcf81a0a8f197d245a14e5c8004e3bb 1 parent 1683299
@halkyon halkyon authored
Showing with 23 additions and 24 deletions.
  1. +23 −24 tests/model/DataExtensionTest.php
View
47 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,16 +181,14 @@ 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'
+ ));
}
}
@@ -198,20 +196,21 @@ public static function add_to_class($class = null, $extensionClass = null, $args
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 {
Please sign in to comment.
Something went wrong with that request. Please try again.