BUGFIX Fixing regression in TranslatableTest due to outdated singleton caching.

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@89911 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2009-10-22 00:30:21 +00:00
parent 11d5ce0274
commit e1a47de20e
4 changed files with 23 additions and 18 deletions

View File

@ -66,11 +66,6 @@ class SapphireTest extends PHPUnit_Framework_TestCase {
SiteTree::reset();
Controller::curr()->setSession(new Session(array()));
// clear singletons, they're caching old extension info
// which is used in DatabaseAdmin->doBuild()
global $_SINGLETONS;
$_SINGLETONS = array();
$className = get_class($this);
$fixtureFile = eval("return {$className}::\$fixture_file;");
@ -119,6 +114,10 @@ class SapphireTest extends PHPUnit_Framework_TestCase {
* for tearing down the state again.
*/
static function set_up_once() {
// clear singletons, they're caching old extension info
// which is used in DatabaseAdmin->doBuild()
global $_SINGLETONS;
$_SINGLETONS = array();
}
/**
@ -228,11 +227,6 @@ class SapphireTest extends PHPUnit_Framework_TestCase {
}
function tearDown() {
// clear singletons, they're caching old extension info
// which is used in DatabaseAdmin->doBuild()
global $_SINGLETONS;
$_SINGLETONS = array();
// Restore email configuration
Email::set_mailer($this->originalMailer);
$this->originalMailer = null;
@ -250,6 +244,10 @@ class SapphireTest extends PHPUnit_Framework_TestCase {
}
static function tear_down_once() {
// clear singletons, they're caching old extension info
// which is used in DatabaseAdmin->doBuild()
global $_SINGLETONS;
$_SINGLETONS = array();
}
/**

View File

@ -9,6 +9,13 @@
*/
class ObjectTest extends SapphireTest {
function setUp() {
parent::setUp();
global $_SINGLETONS;
$_SINGLETONS = array();
}
function testHasmethodBehaviour() {
/* SiteTree should have all of the methods that Versioned has, because Versioned is listed in SiteTree's
* extensions */

View File

@ -15,11 +15,13 @@ class TranslatableTest extends FunctionalTest {
static protected $origTranslatableSettings = array();
static function set_up_once() {
parent::set_up_once();
// needs to recreate the database schema with language properties
self::kill_temp_db();
// store old defaults
self::$origTranslatableSettings['has_extension'] = singleton('SiteTree')->hasExtension('Translatable');
self::$origTranslatableSettings['has_extension'] = Object::has_extension('SiteTree', 'Translatable');
self::$origTranslatableSettings['default_locale'] = Translatable::default_locale();
// overwrite locale
@ -32,8 +34,6 @@ class TranslatableTest extends FunctionalTest {
// recreate database with new settings
$dbname = self::create_temp_db();
DB::set_alternative_database_name($dbname);
parent::set_up_once();
}
static function tear_down_once() {

View File

@ -15,11 +15,13 @@ class TranslatableSearchFormTest extends FunctionalTest {
static protected $origTranslatableSettings = array();
static function set_up_once() {
parent::set_up_once();
// needs to recreate the database schema with language properties
self::kill_temp_db();
// store old defaults
self::$origTranslatableSettings['has_extension'] = singleton('SiteTree')->hasExtension('Translatable');
self::$origTranslatableSettings['has_extension'] = Object::has_extension('SiteTree', 'Translatable');
self::$origTranslatableSettings['default_locale'] = Translatable::default_locale();
// overwrite locale
@ -32,8 +34,6 @@ class TranslatableSearchFormTest extends FunctionalTest {
// recreate database with new settings
$dbname = self::create_temp_db();
DB::set_alternative_database_name($dbname);
parent::set_up_once();
}
function setUp() {