Просмотр исходного кода

ZF-2017: fixed test errors when running Zend_Db_AllTests

git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@16996 44c647ce-9c0f-0410-b52a-842ac1e357ba
mikaelkael 16 лет назад
Родитель
Сommit
538b5c46d1

+ 9 - 0
tests/Zend/Db/Table/Select/Db2Test.php

@@ -44,6 +44,15 @@ class Zend_Db_Table_Select_Db2Test extends Zend_Db_Table_Select_TestCommon
         $this->markTestSkipped($this->getDriver() . ' does not support CROSS JOIN');
     }
 
+    /**
+     * ZF-2017: Test bind use of the Zend_Db_Select class.
+     * @group ZF-2017
+     */
+    public function testSelectQueryWithBinds()
+    {
+        $this->markTestSkipped($this->getDriver() . ' does not support named parameters');
+    }
+
     public function getDriver()
     {
         return 'Db2';

+ 9 - 1
tests/Zend/Db/Table/Select/MysqliTest.php

@@ -31,4 +31,12 @@ class Zend_Db_Table_Select_MysqliTest extends Zend_Db_Table_Select_TestCommon
         return 'Mysqli';
     }
 
-}
+    /**
+     * ZF-2017: Test bind use of the Zend_Db_Select class.
+     * @group ZF-2017
+     */
+    public function testSelectQueryWithBinds()
+    {
+        $this->markTestSkipped($this->getDriver() . ' does not support named parameters');
+    }
+}

+ 17 - 1
tests/Zend/Db/Table/Select/TestCommon.php

@@ -61,11 +61,27 @@ abstract class Zend_Db_Table_Select_TestCommon extends Zend_Db_Select_TestCommon
         if (is_array($options) && !isset($options['db'])) {
             $options['db'] = $this->_db;
         }
-        @Zend_Loader::loadClass($tableClass);
+        if (!class_exists($tableClass)) {
+            $this->_useMyIncludePath();
+            Zend_Loader::loadClass($tableClass);
+            $this->_restoreIncludePath();
+        }
         $table = new $tableClass($options);
         return $table;
     }
 
+    protected function _useMyIncludePath()
+    {
+        $this->_runtimeIncludePath = get_include_path();
+        set_include_path(dirname(__FILE__) . '/../_files/' . PATH_SEPARATOR . $this->_runtimeIncludePath);
+    }
+    
+    protected function _restoreIncludePath()
+    {
+        set_include_path($this->_runtimeIncludePath);
+        $this->_runtimeIncludePath = null;
+    }
+
     /**
      * Get a Zend_Db_Table to provide the base select()
      *