From 3e205b632f54b31d691b66ff577f8c285636fddb Mon Sep 17 00:00:00 2001 From: Sam Minnee Date: Thu, 21 May 2009 08:08:01 +0000 Subject: [PATCH] BUGFIX: Added Versioned::on_db_reset() so that Versioned tests would run properly. git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@77568 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- core/model/Versioned.php | 8 ++++++++ dev/SapphireTest.php | 4 ++++ 2 files changed, 12 insertions(+) diff --git a/core/model/Versioned.php b/core/model/Versioned.php index 320d2c7af..e683065c4 100755 --- a/core/model/Versioned.php +++ b/core/model/Versioned.php @@ -138,6 +138,14 @@ class Versioned extends DataObjectDecorator { */ private static $archive_tables = array(); + /** + * Called by {@link SapphireTest} when the database is reset. + * @todo Reduce the coupling between this and SapphireTest, somehow. + */ + public static function on_db_reset() { + self::$archive_tables = array(); + } + /** * Create a temporary table mapping each database record to its version on the given date. * This is used by the versioning system to return database content on that date. diff --git a/dev/SapphireTest.php b/dev/SapphireTest.php index c4f3a8e87..97d61f856 100644 --- a/dev/SapphireTest.php +++ b/dev/SapphireTest.php @@ -233,6 +233,10 @@ class SapphireTest extends PHPUnit_Framework_TestCase { // echo "Deleted temp database " . $dbConn->currentDatabase() . "\n"; $dbConn->dropDatabase(); } + + // Todo: it would be good to remove this inappropriate coupling, somehow. + // The versioned class keeps a static cache of information about temporary tables. + Versioned::on_db_reset(); } }