From 667c09072810384404ba4572becfc5103bb583d5 Mon Sep 17 00:00:00 2001 From: Tim Hunt Date: Thu, 10 May 2012 16:22:09 +0100 Subject: [PATCH] MDL-32924 improve unit test performance. --- lib/phpunit/lib.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/phpunit/lib.php b/lib/phpunit/lib.php index 179b8f7fe94..ce05ae8a1c9 100644 --- a/lib/phpunit/lib.php +++ b/lib/phpunit/lib.php @@ -432,15 +432,16 @@ class phpunit_util { public static function reset_database() { global $DB; + if (!is_null(self::$lastdbwrites) and self::$lastdbwrites == $DB->perf_get_writes()) { + return false; + } + $tables = $DB->get_tables(false); if (!$tables or empty($tables['config'])) { // not installed yet return false; } - if (!is_null(self::$lastdbwrites) and self::$lastdbwrites == $DB->perf_get_writes()) { - return false; - } if (!$data = self::get_tabledata()) { // not initialised yet return false;