Cleaning up Test DataObjects to ensure TestOnly is implemented

This commit is contained in:
Daniel Hensby 2015-02-12 13:15:32 +00:00
parent d5bb290b8e
commit 0ca0bb55b0
8 changed files with 35 additions and 13 deletions

View File

@ -6,6 +6,14 @@
*/ */
class ClassInfoTest extends SapphireTest { class ClassInfoTest extends SapphireTest {
protected $extraDataObjects = array(
'ClassInfoTest_BaseClass',
'ClassInfoTest_ChildClass',
'ClassInfoTest_GrandChildClass',
'ClassInfoTest_BaseDataClass',
'ClassInfoTest_NoFields',
);
public function testExists() { public function testExists() {
$this->assertTrue(ClassInfo::exists('Object')); $this->assertTrue(ClassInfo::exists('Object'));
$this->assertTrue(ClassInfo::exists('ClassInfoTest')); $this->assertTrue(ClassInfo::exists('ClassInfoTest'));
@ -146,7 +154,7 @@ class ClassInfoTest extends SapphireTest {
* @subpackage tests * @subpackage tests
*/ */
class ClassInfoTest_BaseClass extends DataObject { class ClassInfoTest_BaseClass extends DataObject implements TestOnly {
} }
@ -173,7 +181,7 @@ class ClassInfoTest_GrandChildClass extends ClassInfoTest_ChildClass {
* @subpackage tests * @subpackage tests
*/ */
class ClassInfoTest_BaseDataClass extends DataObject { class ClassInfoTest_BaseDataClass extends DataObject implements TestOnly {
private static $db = array( private static $db = array(
'Title' => 'Varchar' 'Title' => 'Varchar'

View File

@ -37,7 +37,7 @@ class CompositeDBFieldTest extends SapphireTest {
} }
} }
class CompositeDBFieldTest_DataObject extends DataObject { class CompositeDBFieldTest_DataObject extends DataObject implements TestOnly {
private static $db = array( private static $db = array(
'Title' => 'Text', 'Title' => 'Text',
'MyMoney' => 'Money', 'MyMoney' => 'Money',

View File

@ -19,7 +19,10 @@ class DataListTest extends SapphireTest {
'DataObjectTest_ValidatedObject', 'DataObjectTest_ValidatedObject',
'DataObjectTest_Player', 'DataObjectTest_Player',
'DataObjectTest_TeamComment', 'DataObjectTest_TeamComment',
'DataObjectTest_ExtendedTeamComment',
'DataObjectTest\NamespacedClass', 'DataObjectTest\NamespacedClass',
'DataObjectTest_Company',
'DataObjectTest_Fan',
); );
public function testFilterDataObjectByCreatedDate() { public function testFilterDataObjectByCreatedDate() {

View File

@ -21,9 +21,10 @@ class DataObjectLazyLoadingTest extends SapphireTest {
'DataObjectTest_FieldlessSubTable', 'DataObjectTest_FieldlessSubTable',
'DataObjectTest_ValidatedObject', 'DataObjectTest_ValidatedObject',
'DataObjectTest_Player', 'DataObjectTest_Player',
'DataObjectTest_TeamComment',
'VersionedTest_DataObject', 'VersionedTest_DataObject',
'VersionedTest_Subclass' 'VersionedTest_Subclass',
'VersionedLazy_DataObject',
'VersionedLazySub_DataObject',
); );
public function testQueriedColumnsID() { public function testQueriedColumnsID() {
@ -403,7 +404,7 @@ class DataObjectLazyLoadingTest extends SapphireTest {
/** Additional classes for versioned lazy loading testing */ /** Additional classes for versioned lazy loading testing */
class VersionedLazy_DataObject extends DataObject { class VersionedLazy_DataObject extends DataObject implements TestOnly {
private static $db = array( private static $db = array(
"PageName" => "Varchar" "PageName" => "Varchar"
); );

View File

@ -19,7 +19,11 @@ class DataObjectTest extends SapphireTest {
'DataObjectTest_TeamComment', 'DataObjectTest_TeamComment',
'DataObjectTest\NamespacedClass', 'DataObjectTest\NamespacedClass',
'DataObjectTest\RelationClass', 'DataObjectTest\RelationClass',
'DataObjectTest_ExtendedTeamComment' 'DataObjectTest_ExtendedTeamComment',
'DataObjectTest_Company',
'DataObjectTest_Staff',
'DataObjectTest_CEO',
'DataObjectTest_Fan',
); );
public function testDb() { public function testDb() {
@ -1642,7 +1646,7 @@ class DataObjectTest_ValidatedObject extends DataObject implements TestOnly {
} }
} }
class DataObjectTest_Company extends DataObject { class DataObjectTest_Company extends DataObject implements TestOnly {
private static $db = array( private static $db = array(
'Name' => 'Varchar' 'Name' => 'Varchar'
@ -1660,7 +1664,7 @@ class DataObjectTest_Company extends DataObject {
); );
} }
class DataObjectTest_Staff extends DataObject { class DataObjectTest_Staff extends DataObject implements TestOnly {
private static $has_one = array ( private static $has_one = array (
'CurrentCompany' => 'DataObjectTest_Company', 'CurrentCompany' => 'DataObjectTest_Company',
'PreviousCompany' => 'DataObjectTest_Company' 'PreviousCompany' => 'DataObjectTest_Company'
@ -1675,7 +1679,7 @@ class DataObjectTest_CEO extends DataObjectTest_Staff {
); );
} }
class DataObjectTest_TeamComment extends DataObject { class DataObjectTest_TeamComment extends DataObject implements TestOnly {
private static $db = array( private static $db = array(
'Name' => 'Varchar', 'Name' => 'Varchar',
'Comment' => 'Text' 'Comment' => 'Text'
@ -1687,7 +1691,7 @@ class DataObjectTest_TeamComment extends DataObject {
} }
class DataObjectTest_Fan extends DataObject { class DataObjectTest_Fan extends DataObject implements TestOnly {
private static $db = array( private static $db = array(
'Name' => 'Varchar(255)' 'Name' => 'Varchar(255)'

View File

@ -9,6 +9,7 @@ class HasManyListTest extends SapphireTest {
'DataObjectTest_Team', 'DataObjectTest_Team',
'DataObjectTest_SubTeam', 'DataObjectTest_SubTeam',
'DataObjectTest_Player', 'DataObjectTest_Player',
'DataObjectTest_TeamComment',
); );
public function testRelationshipEmptyOnNewRecords() { public function testRelationshipEmptyOnNewRecords() {

View File

@ -19,7 +19,7 @@ class PolymorphicHasManyListTest extends SapphireTest {
'DataObjectTest_Team', 'DataObjectTest_Team',
'DataObjectTest_SubTeam', 'DataObjectTest_SubTeam',
'DataObjectTest_Player', 'DataObjectTest_Player',
'DataObjectTest_Fan' 'DataObjectTest_Fan',
); );
public function testRelationshipEmptyOnNewRecords() { public function testRelationshipEmptyOnNewRecords() {

View File

@ -1,6 +1,11 @@
<?php <?php
class SSViewerTest extends SapphireTest { class SSViewerTest extends SapphireTest {
protected $extraDataObjects = array(
'SSViewerTest_Object',
);
public function setUp() { public function setUp() {
parent::setUp(); parent::setUp();
Config::inst()->update('SSViewer', 'source_file_comments', false); Config::inst()->update('SSViewer', 'source_file_comments', false);
@ -1461,7 +1466,7 @@ class SSViewerTest_Controller extends Controller {
} }
class SSViewerTest_Object extends DataObject { class SSViewerTest_Object extends DataObject implements TestOnly {
public $number = null; public $number = null;