Fix unit tests after cache changes.
authorChuck Hagenbuch <chuck@horde.org>
Sun, 30 May 2010 14:06:50 +0000 (10:06 -0400)
committerChuck Hagenbuch <chuck@horde.org>
Sun, 30 May 2010 14:06:50 +0000 (10:06 -0400)
framework/Db/test/Horde/Db/Adapter/MysqliSuite.php
framework/Db/test/Horde/Db/Adapter/Pdo/MysqlSuite.php
framework/Db/test/Horde/Db/Adapter/Pdo/PgsqlSuite.php
framework/Db/test/Horde/Db/Adapter/Pdo/SqliteSuite.php

index fdec080..0f0c016 100644 (file)
@@ -59,22 +59,22 @@ class Horde_Db_Adapter_MysqliSuite extends PHPUnit_Framework_TestSuite
 
     public function getConnection()
     {
-        if (!class_exists('CacheMock', false)) eval('class CacheMock { function get($key) { return $this->$key; } function set($key, $val) { $this->$key = $val; } } ?>');
-        $cache = new CacheMock;
-
         $config = getenv('DB_ADAPTER_MYSQLI_TEST_CONFIG');
         if ($config === false) {
             $config = dirname(__FILE__) . '/conf.php';
         }
         if (file_exists($config)) {
             require $config;
-            $conf['db']['adapter']['mysqli']['test']['cache'] = $cache;
         }
         if (!isset($conf['db']['adapter']['mysqli']['test'])) {
             throw new Exception('No configuration for mysqli test.');
         }
 
         $conn = new Horde_Db_Adapter_Mysqli($conf['db']['adapter']['mysqli']['test']);
+
+        $cache = new Horde_Cache_Mock();
+        $conn->setCache($cache);
+
         return array($conn, $cache);
     }
 
index 25c73fd..61da85a 100644 (file)
@@ -59,22 +59,22 @@ class Horde_Db_Adapter_Pdo_MysqlSuite extends PHPUnit_Framework_TestSuite
 
     public function getConnection()
     {
-        if (!class_exists('CacheMock', false)) eval('class CacheMock { function get($key) { return $this->$key; } function set($key, $val) { $this->$key = $val; } } ?>');
-        $cache = new CacheMock;
-
         $config = getenv('DB_ADAPTER_PDO_MYSQL_TEST_CONFIG');
         if ($config === false) {
             $config = dirname(__FILE__) . '/../conf.php';
         }
         if (file_exists($config)) {
             require $config;
-            $conf['db']['adapter']['pdo']['mysql']['test']['cache'] = $cache;
         }
         if (!isset($conf['db']['adapter']['pdo']['mysql']['test'])) {
             throw new Exception('No configuration for pdo mysql test.');
         }
 
         $conn = new Horde_Db_Adapter_Pdo_Mysql($conf['db']['adapter']['pdo']['mysql']['test']);
+
+        $cache = new Horde_Cache_Mock();
+        $conn->setCache($cache);
+
         return array($conn, $cache);
     }
 
index f6b8bff..32359b6 100644 (file)
@@ -62,22 +62,22 @@ class Horde_Db_Adapter_Pdo_PgsqlSuite extends PHPUnit_Framework_TestSuite
     {
         if (!is_null(self::$conn)) { return self::$conn; }
 
-        if (!class_exists('CacheMock', false)) eval('class CacheMock { function get($key) { return $this->$key; } function set($key, $val) { $this->$key = $val; } } ?>');
-        $cache = new CacheMock;
-
         $config = getenv('DB_ADAPTER_PDO_PGSQL_TEST_CONFIG');
         if ($config === false) {
             $config = dirname(__FILE__) . '/../conf.php';
         }
         if (file_exists($config)) {
             require $config;
-            $conf['db']['adapter']['pdo']['pgsql']['test']['cache'] = $cache;
         }
         if (!isset($conf['db']['adapter']['pdo']['pgsql']['test'])) {
             throw new Exception('No configuration for pdo pgsql test.');
         }
 
         $conn = new Horde_Db_Adapter_Pdo_Pgsql($conf['db']['adapter']['pdo']['pgsql']['test']);
+
+        $cache = new Horde_Cache_Mock();
+        $conn->setCache($cache);
+
         return array($conn, $cache);
     }
 
index e3641dc..cf5b2bc 100644 (file)
@@ -59,14 +59,13 @@ class Horde_Db_Adapter_Pdo_SqliteSuite extends PHPUnit_Framework_TestSuite
 
     public function getConnection()
     {
-        if (!class_exists('CacheMock', false)) eval('class CacheMock { function get($key) { return $this->$key; } function set($key, $val) { $this->$key = $val; } } ?>');
-        $cache = new CacheMock;
-
         $conn = new Horde_Db_Adapter_Pdo_Sqlite(array(
             'dbname' => ':memory:',
-            'cache' => $cache,
         ));
 
+        $cache = new Horde_Cache_Mock();
+        $conn->setCache($cache);
+
         return array($conn, $cache);
     }