From 623447ffea7a49359c773a0bc3a851397885f319 Mon Sep 17 00:00:00 2001 From: wei <> Date: Fri, 28 Jul 2006 12:32:01 +0000 Subject: Add sqlite support for time-tracker. --- demos/time-tracker/tests/unit/BaseTestCase.php | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'demos/time-tracker/tests/unit/BaseTestCase.php') diff --git a/demos/time-tracker/tests/unit/BaseTestCase.php b/demos/time-tracker/tests/unit/BaseTestCase.php index 8ce3cca8..549229e3 100644 --- a/demos/time-tracker/tests/unit/BaseTestCase.php +++ b/demos/time-tracker/tests/unit/BaseTestCase.php @@ -1,5 +1,8 @@ sqlmap = $app->getModule('daos')->getConnection(); } + function flushDatabase() + { + $conn = $this->sqlmap->openConnection(); + switch(strtolower($conn->getProvider()->getDriver())) + { + case 'mysql': + return $this->flushMySQLDatabase(); + case 'sqlite': + return $this->flushSQLiteDatabase(); + } + } + + function flushSQLiteDatabase() + { + $conn = $this->sqlmap->openConnection(); + $file = $conn->getProvider()->getHost(); + $backup = $file.'.bak'; + copy($backup, $file); + } + + function flushMySQLDatabase() { $conn = $this->sqlmap->openConnection(); $file = Prado::getPathOfNamespace('Application.App_Data.mysql-reset','.sql'); -- cgit v1.2.3