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

Merge pull request #320 from mhujer/db-tests

DB tests are enabled for Travis and fixed to be passing
Frank Brückner 11 лет назад
Родитель
Сommit
6fb5c4bbad

+ 10 - 0
.travis.yml

@@ -14,6 +14,16 @@ install:
  - sh ./tests/install_dependencies.sh
  - phpenv rehash
 
+services:
+  - memcached
+
+before_script:
+  - mysql -e 'create database zftest;'
+  - psql -c 'create database zftest;' -U postgres
+  - echo "extension = memcache.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
+  - echo "extension = memcached.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
+  - cp ./tests/TestConfiguration.travis.php ./tests/TestConfiguration.php
+
 script:
  - cd tests/
  - php runalltests.php

+ 20 - 20
library/Zend/Db/Table/Abstract.php

@@ -1041,16 +1041,6 @@ abstract class Zend_Db_Table_Abstract
         $primary = (array) $this->_primary;
         $pkIdentity = $primary[(int)$this->_identity];
 
-        /**
-         * If this table uses a database sequence object and the data does not
-         * specify a value, then get the next ID from the sequence and add it
-         * to the row.  We assume that only the first column in a compound
-         * primary key takes a value from a sequence.
-         */
-        if (is_string($this->_sequence) && !isset($data[$pkIdentity])) {
-            $data[$pkIdentity] = $this->_db->nextSequenceId($this->_sequence);
-            $pkSuppliedBySequence = true;
-        }
 
         /**
          * If the primary key can be generated automatically, and no value was
@@ -1060,7 +1050,7 @@ abstract class Zend_Db_Table_Abstract
          * position of the data.  The following values are considered empty:
          *   null, false, true, '', array()
          */
-        if (!isset($pkSuppliedBySequence) && array_key_exists($pkIdentity, $data)) {
+        if (array_key_exists($pkIdentity, $data)) {
             if ($data[$pkIdentity] === null                                        // null
                 || $data[$pkIdentity] === ''                                       // empty string
                 || is_bool($data[$pkIdentity])                                     // boolean
@@ -1070,6 +1060,16 @@ abstract class Zend_Db_Table_Abstract
         }
 
         /**
+         * If this table uses a database sequence object and the data does not
+         * specify a value, then get the next ID from the sequence and add it
+         * to the row.  We assume that only the first column in a compound
+         * primary key takes a value from a sequence.
+         */
+        if (is_string($this->_sequence) && !isset($data[$pkIdentity])) {
+            $data[$pkIdentity] = $this->_db->nextSequenceId($this->_sequence);
+        }
+
+        /**
          * INSERT the new row.
          */
         $tableSpec = ($this->_schema ? $this->_schema . '.' : '') . $this->_name;
@@ -1212,20 +1212,20 @@ abstract class Zend_Db_Table_Abstract
     {
         // setup metadata
         $this->_setupMetadata();
-        
+
         // get this class name
         $thisClass = get_class($this);
         if ($thisClass === 'Zend_Db_Table') {
             $thisClass = $this->_definitionConfigName;
         }
-        
+
         $rowsAffected = 0;
-        
+
         foreach ($this->_getReferenceMapNormalized() as $map) {
             if ($map[self::REF_TABLE_CLASS] == $parentTableClassname && isset($map[self::ON_DELETE])) {
-                
+
                 $where = array();
-                
+
                 // CASCADE or CASCADE_RECURSE
                 if (in_array($map[self::ON_DELETE], array(self::CASCADE, self::CASCADE_RECURSE))) {
                     for ($i = 0; $i < count($map[self::COLUMNS]); ++$i) {
@@ -1237,10 +1237,10 @@ abstract class Zend_Db_Table_Abstract
                             $primaryKey[$refCol], $type);
                     }
                 }
-                
+
                 // CASCADE_RECURSE
                 if ($map[self::ON_DELETE] == self::CASCADE_RECURSE) {
-                    
+
                     /**
                      * Execute cascading deletes against dependent tables
                      */
@@ -1259,7 +1259,7 @@ abstract class Zend_Db_Table_Abstract
                 if (in_array($map[self::ON_DELETE], array(self::CASCADE, self::CASCADE_RECURSE))) {
                     $rowsAffected += $this->delete($where);
                 }
-                
+
             }
         }
         return $rowsAffected;
@@ -1610,5 +1610,5 @@ abstract class Zend_Db_Table_Abstract
 
         return new $tableName($options);
     }
-    
+
 }

+ 85 - 0
tests/TestConfiguration.travis.php

@@ -0,0 +1,85 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category   Zend
+ * @package    UnitTests
+ * @copyright  Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ * @version    $Id$
+ */
+
+/**
+ * This file defines configuration for running the unit tests for the Zend
+ * Framework.  Some tests have dependencies to PHP extensions or databases
+ * which may not necessary installed on the target system.  For these cases,
+ * the ability to disable or configure testing is provided below.  Tests for
+ * components which should run universally are always run by the master
+ * suite and cannot be disabled.
+ *
+ * Do not edit this file. Instead, copy this file to TestConfiguration.php,
+ * and edit the new file. Never commit plaintext passwords to the source
+ * code repository.
+ */
+ 
+ /**
+ * Zend_Auth_Adapter_DbTable tests
+ */
+defined('TESTS_ZEND_AUTH_ADAPTER_DBTABLE_PDO_SQLITE_ENABLED') || define('TESTS_ZEND_AUTH_ADAPTER_DBTABLE_PDO_SQLITE_ENABLED', true);
+
+/**
+ * Zend_Cache
+ *
+ * TESTS_ZEND_CACHE_SQLITE_ENABLED     => sqlite extension has to be enabled
+ * TESTS_ZEND_CACHE_APC_ENABLED        => apc extension has to be enabled
+ * TESTS_ZEND_CACHE_WINCACHE_ENABLED   => wincache extension has to be enabled
+ * TESTS_ZEND_CACHE_MEMCACHED_ENABLED  => memcache extension has to be enabled and
+ *                                        a memcached server has to be available
+ * TESTS_ZEND_CACHE_LIBMEMCACHED_ENABLED => memcached extension has to be enabled and
+ *                                          a memcached server has to be available
+ * TESTS_ZEND_CACHE_XCACHE_ENABLED     => xcache extension has to be enabled
+ */
+defined('TESTS_ZEND_CACHE_SQLITE_ENABLED') || define('TESTS_ZEND_CACHE_SQLITE_ENABLED', true);
+defined('TESTS_ZEND_CACHE_MEMCACHED_ENABLED') || define('TESTS_ZEND_CACHE_MEMCACHED_ENABLED', true);
+defined('TESTS_ZEND_CACHE_LIBMEMCACHED_ENABLED') || define('TESTS_ZEND_CACHE_LIBMEMCACHED_ENABLED', true);
+
+/**
+ * Zend_Db_Adapter_Pdo_Mysql and Zend_Db_Adapter_Mysqli
+ *
+ * There are separate properties to enable tests for the PDO_MYSQL adapter and
+ * the native Mysqli adapters, but the other properties are shared between the
+ * two MySQL-related Zend_Db adapters.
+ */
+defined('TESTS_ZEND_DB_ADAPTER_PDO_MYSQL_ENABLED') || define('TESTS_ZEND_DB_ADAPTER_PDO_MYSQL_ENABLED',  true);
+defined('TESTS_ZEND_DB_ADAPTER_MYSQLI_ENABLED') || define('TESTS_ZEND_DB_ADAPTER_MYSQLI_ENABLED',  true);
+defined('TESTS_ZEND_DB_ADAPTER_MYSQL_USERNAME') || define('TESTS_ZEND_DB_ADAPTER_MYSQL_USERNAME', 'travis');
+defined('TESTS_ZEND_DB_ADAPTER_MYSQL_PASSWORD') || define('TESTS_ZEND_DB_ADAPTER_MYSQL_PASSWORD', '');
+defined('TESTS_ZEND_DB_ADAPTER_MYSQL_DATABASE') || define('TESTS_ZEND_DB_ADAPTER_MYSQL_DATABASE', 'zftest');
+
+/**
+ * Zend_Db_Adapter_Pdo_Sqlite
+ *
+ * Username and password are irrelevant for SQLite.
+ */
+defined('TESTS_ZEND_DB_ADAPTER_PDO_SQLITE_ENABLED') || define('TESTS_ZEND_DB_ADAPTER_PDO_SQLITE_ENABLED',  true);
+
+/**
+ * Zend_Db_Adapter_Pdo_Pgsql
+ */
+defined('TESTS_ZEND_DB_ADAPTER_PDO_PGSQL_ENABLED') || define('TESTS_ZEND_DB_ADAPTER_PDO_PGSQL_ENABLED',  true);
+defined('TESTS_ZEND_DB_ADAPTER_PDO_PGSQL_USERNAME') || define('TESTS_ZEND_DB_ADAPTER_PDO_PGSQL_USERNAME', 'postgres');
+defined('TESTS_ZEND_DB_ADAPTER_PDO_PGSQL_PASSWORD') || define('TESTS_ZEND_DB_ADAPTER_PDO_PGSQL_PASSWORD', '');
+defined('TESTS_ZEND_DB_ADAPTER_PDO_PGSQL_DATABASE') || define('TESTS_ZEND_DB_ADAPTER_PDO_PGSQL_DATABASE', 'zftest');
+
+
+require_once dirname(__FILE__) . '/TestConfiguration.php.dist';

+ 47 - 0
tests/Zend/Db/Adapter/Pdo/SqliteTest.php

@@ -200,4 +200,51 @@ class Zend_Db_Adapter_Pdo_SqliteTest extends Zend_Db_Adapter_Pdo_TestCommon
         return 'Pdo_Sqlite';
     }
 
+    public function testAdapterOptionFetchMode()
+    {
+        $params = $this->_util->getParams();
+
+        $params['options'] = array(
+            Zend_Db::FETCH_MODE => 'obj'
+        );
+        $db = Zend_Db::factory($this->getDriver(), $params);
+
+        //two extra lines to make SQLite work
+        $db->query('CREATE TABLE zfproducts (id)');
+        $db->insert('zfproducts', array('id' => 1));
+
+        $select = $db->select()->from('zfproducts');
+        $row = $db->fetchRow($select);
+        $this->assertTrue($row instanceof stdClass);
+    }
+
+    protected function _testAdapterAlternateStatement($stmtClass)
+    {
+        $ip = get_include_path();
+        $dir = dirname(__FILE__) . DIRECTORY_SEPARATOR .  '..' . DIRECTORY_SEPARATOR . '_files';
+        $newIp = $dir . PATH_SEPARATOR . $ip;
+        set_include_path($newIp);
+
+        $params = $this->_util->getParams();
+
+        $params['options'] = array(
+            Zend_Db::AUTO_QUOTE_IDENTIFIERS => false
+        );
+        $db = Zend_Db::factory($this->getDriver(), $params);
+        $db->getConnection();
+        $db->setStatementClass($stmtClass);
+
+        $currentStmtClass = $db->getStatementClass();
+        $this->assertEquals($stmtClass, $currentStmtClass);
+
+        //extra fix for SQLite
+        $db->query('CREATE TABLE zfbugs (id)');
+
+        $bugs = $this->_db->quoteIdentifier('zfbugs');
+
+        $stmt = $db->prepare("SELECT COUNT(*) FROM $bugs");
+
+        $this->assertTrue($stmt instanceof $stmtClass,
+            'Expecting object of type ' . $stmtClass . ', got ' . get_class($stmt));
+    }
 }

+ 24 - 0
tests/Zend/Db/Select/Pdo/SqliteTest.php

@@ -57,6 +57,10 @@ class Zend_Db_Select_Pdo_SqliteTest extends Zend_Db_Select_TestCommon
 
     public function testSelectGroupBy()
     {
+        //SQLite doesn't need different test from 5.3
+        if (version_compare(PHP_VERSION, '5.3.0', '>=')) {
+            return parent::testSelectGroupBy();
+        }
         $select = $this->_selectGroupBy();
         $stmt = $this->_db->query($select);
         $result = $stmt->fetchAll();
@@ -74,6 +78,10 @@ class Zend_Db_Select_Pdo_SqliteTest extends Zend_Db_Select_TestCommon
 
     public function testSelectGroupByQualified()
     {
+        //SQLite doesn't need different test from 5.3
+        if (version_compare(PHP_VERSION, '5.3.0', '>=')) {
+            return parent::testSelectGroupByQualified();
+        }
         $select = $this->_selectGroupByQualified();
         $stmt = $this->_db->query($select);
         $result = $stmt->fetchAll();
@@ -91,6 +99,10 @@ class Zend_Db_Select_Pdo_SqliteTest extends Zend_Db_Select_TestCommon
 
     public function testSelectHaving()
     {
+        //SQLite doesn't need different test from 5.3
+        if (version_compare(PHP_VERSION, '5.3.0', '>=')) {
+            return parent::testSelectHaving();
+        }
         $select = $this->_selectHaving();
         $stmt = $this->_db->query($select);
         $result = $stmt->fetchAll();
@@ -104,6 +116,10 @@ class Zend_Db_Select_Pdo_SqliteTest extends Zend_Db_Select_TestCommon
 
     public function testSelectHavingWithParameter()
     {
+        //SQLite doesn't need different test from 5.3
+        if (version_compare(PHP_VERSION, '5.3.0', '>=')) {
+            return parent::testSelectHavingWithParameter();
+        }
         $select = $this->_selectHavingWithParameter();
         $stmt = $this->_db->query($select);
         $result = $stmt->fetchAll();
@@ -117,6 +133,10 @@ class Zend_Db_Select_Pdo_SqliteTest extends Zend_Db_Select_TestCommon
 
     public function testSelectHavingOr()
     {
+        //SQLite doesn't need different test from 5.3
+        if (version_compare(PHP_VERSION, '5.3.0', '>=')) {
+            return parent::testSelectHavingOr();
+        }
         $select = $this->_selectHavingOr();
         $stmt = $this->_db->query($select);
         $result = $stmt->fetchAll();
@@ -132,6 +152,10 @@ class Zend_Db_Select_Pdo_SqliteTest extends Zend_Db_Select_TestCommon
 
     public function testSelectHavingOrWithParameter()
     {
+        //SQLite doesn't need different test from 5.3
+        if (version_compare(PHP_VERSION, '5.3.0', '>=')) {
+            return parent::testSelectHavingOrWithParameter();
+        }
         $select = $this->_selectHavingOrWithParameter();
         $stmt = $this->_db->query($select);
         $result = $stmt->fetchAll();

+ 9 - 9
tests/Zend/Db/Select/TestCommon.php

@@ -858,7 +858,7 @@ abstract class Zend_Db_Select_TestCommon extends Zend_Db_TestSetup
 
     public function testSelectWhereWithTypeFloat()
     {
-        $locale = setlocale(LC_ALL, null);
+        $locale = setlocale(LC_ALL, 0);
 
         $select = $this->_selectWhereWithTypeFloat();
         $stmt = $this->_db->query($select);
@@ -1697,7 +1697,7 @@ abstract class Zend_Db_Select_TestCommon extends Zend_Db_TestSetup
         $serialize = serialize($this->_select());
         $this->assertTrue(is_string($serialize));
     }
-    
+
     /**
      * @group ZF-3792
      */
@@ -1706,7 +1706,7 @@ abstract class Zend_Db_Select_TestCommon extends Zend_Db_TestSetup
         $table_A = $this->_db->quoteTableAs('A');
         $table_B = $this->_db->quoteTableAs('B');
         $colname = $this->_db->quoteIdentifier('colname');
-        
+
         $s = $this->_db->select()->from('A')->joinUsing('B', $colname);
         $this->assertContains("JOIN {$table_B} ON {$table_B}.{$colname} = {$table_A}.{$colname}", $s->assemble());
     }
@@ -1720,7 +1720,7 @@ abstract class Zend_Db_Select_TestCommon extends Zend_Db_TestSetup
         $table_B = $this->_db->quoteTableAs('B');
         $colOne  = $this->_db->quoteIdentifier('colOne');
         $colTwo  = $this->_db->quoteIdentifier('colTwo');
-        
+
         $s = $this->_db->select()->from('A')->joinUsing('B', array($colOne,$colTwo));
         $this->assertContains(
             "JOIN {$table_B} ON {$table_B}.{$colOne} = {$table_A}.{$colOne}"
@@ -1737,12 +1737,12 @@ abstract class Zend_Db_Select_TestCommon extends Zend_Db_TestSetup
         $table1 = $this->_db->quoteTableAs('table1');
         $table2 = $this->_db->quoteTableAs('table2');
         $colname = $this->_db->quoteIdentifier('column1');
-        
+
         $select = $this->_db->select();
         $select->from('table1')->joinUsing('table2', $colname);
         $this->assertRegexp("/ON {$table2}.{$colname}/s", $select->assemble());
     }
-    
+
     /**
      * @group ZF-3309
      */
@@ -1751,10 +1751,10 @@ abstract class Zend_Db_Select_TestCommon extends Zend_Db_TestSetup
         $table1 = $this->_db->quoteTableAs('table1');
         $table2_alias = $this->_db->quoteTableAs('t2');
         $colname = $this->_db->quoteIdentifier('column1');
-        
+
         $select = $this->_db->select();
         $select->from('table1')->joinUsing(array('t2'=>'table2'), $colname);
         $this->assertRegexp("/ON {$table2_alias}.{$colname}/s", $select->assemble());
-    }    
-    
+    }
+
 }

+ 1 - 2
tests/Zend/Db/Table/Rowset/TestCommon.php

@@ -386,7 +386,7 @@ abstract class Zend_Db_Table_Rowset_TestCommon extends Zend_Db_Table_TestSetup
         $this->assertTrue($row->isConnected());
         $this->assertTrue($row->getTable() instanceof Zend_Db_Table_Abstract);
     }
- 
+
     /**
       * @group GH-172
       */
@@ -415,7 +415,6 @@ abstract class Zend_Db_Table_Rowset_TestCommon extends Zend_Db_Table_TestSetup
         $tableClass = get_class($table);
 
         $select = $table->select(Zend_Db_Table::SELECT_WITH_FROM_PART)->setIntegrityCheck(false);
-        $select->from('zfbugs', array('bug_id'));
         $select->join('zfaccounts', 'zfaccounts.account_name = zfbugs.reported_by', 'account_name');
         $select->where('zfaccounts.account_name = ?', 'Bob');
 

+ 24 - 0
tests/Zend/Db/Table/Select/Pdo/SqliteTest.php

@@ -61,6 +61,10 @@ class Zend_Db_Table_Select_Pdo_SqliteTest extends Zend_Db_Table_Select_TestCommo
 
     public function testSelectGroupBy()
     {
+        //SQLite doesn't need different test from 5.3
+        if (version_compare(PHP_VERSION, '5.3.0', '>=')) {
+            return parent::testSelectGroupBy();
+        }
         $select = $this->_selectGroupBy();
         $stmt = $this->_db->query($select);
         $result = $stmt->fetchAll();
@@ -78,6 +82,10 @@ class Zend_Db_Table_Select_Pdo_SqliteTest extends Zend_Db_Table_Select_TestCommo
 
     public function testSelectGroupByQualified()
     {
+        //SQLite doesn't need different test from 5.3
+        if (version_compare(PHP_VERSION, '5.3.0', '>=')) {
+            return parent::testSelectGroupByQualified();
+        }
         $select = $this->_selectGroupByQualified();
         $stmt = $this->_db->query($select);
         $result = $stmt->fetchAll();
@@ -95,6 +103,10 @@ class Zend_Db_Table_Select_Pdo_SqliteTest extends Zend_Db_Table_Select_TestCommo
 
     public function testSelectHaving()
     {
+        //SQLite doesn't need different test from 5.3
+        if (version_compare(PHP_VERSION, '5.3.0', '>=')) {
+            return parent::testSelectHaving();
+        }
         $select = $this->_selectHaving();
         $stmt = $this->_db->query($select);
         $result = $stmt->fetchAll();
@@ -108,6 +120,10 @@ class Zend_Db_Table_Select_Pdo_SqliteTest extends Zend_Db_Table_Select_TestCommo
 
     public function testSelectHavingWithParameter()
     {
+        //SQLite doesn't need different test from 5.3
+        if (version_compare(PHP_VERSION, '5.3.0', '>=')) {
+            return parent::testSelectHavingWithParameter();
+        }
         $select = $this->_selectHavingWithParameter();
         $stmt = $this->_db->query($select);
         $result = $stmt->fetchAll();
@@ -121,6 +137,10 @@ class Zend_Db_Table_Select_Pdo_SqliteTest extends Zend_Db_Table_Select_TestCommo
 
     public function testSelectHavingOr()
     {
+        //SQLite doesn't need different test from 5.3
+        if (version_compare(PHP_VERSION, '5.3.0', '>=')) {
+            return parent::testSelectHavingOr();
+        }
         $select = $this->_selectHavingOr();
         $stmt = $this->_db->query($select);
         $result = $stmt->fetchAll();
@@ -136,6 +156,10 @@ class Zend_Db_Table_Select_Pdo_SqliteTest extends Zend_Db_Table_Select_TestCommo
 
     public function testSelectHavingOrWithParameter()
     {
+        //SQLite doesn't need different test from 5.3
+        if (version_compare(PHP_VERSION, '5.3.0', '>=')) {
+            return parent::testSelectHavingOrWithParameter();
+        }
         $select = $this->_selectHavingOrWithParameter();
         $stmt = $this->_db->query($select);
         $result = $stmt->fetchAll();

+ 8 - 8
tests/Zend/Db/Table/TestCommon.php

@@ -675,7 +675,7 @@ abstract class Zend_Db_Table_TestCommon extends Zend_Db_Table_TestSetup
         $this->assertEquals($insertResult, $lastInsertId);
         $this->assertEquals(5, $lastInsertId);
     }
-    
+
     /**
      * @group ZF-3837
      */
@@ -693,7 +693,7 @@ abstract class Zend_Db_Table_TestCommon extends Zend_Db_Table_TestSetup
             'verified_by'     => 'dduck'
         );
         $insertResult = $table->insert($row);
-        $lastInsertId = $this->_db->lastInsertId();
+        $lastInsertId = $this->_db->lastInsertId('zfbugs', 'bug_id');
         $this->assertEquals($insertResult, $lastInsertId);
         $this->assertEquals(5, $lastInsertId);
     }
@@ -836,7 +836,7 @@ abstract class Zend_Db_Table_TestCommon extends Zend_Db_Table_TestSetup
         $mem_delta = $mem2-$mem1;
         $this->assertThat($mem_delta, $this->lessThan(513));
     }
-    
+
     /**
      * @group ZF-2953
      */
@@ -852,12 +852,12 @@ abstract class Zend_Db_Table_TestCommon extends Zend_Db_Table_TestSetup
             'assigned_to'     => 'goofy',
             'verified_by'     => 'dduck'
         );
-        
+
         // empty string
         $row['bug_id'] = '';
         $insertResult = $table->insert($row);
         $this->assertTrue(is_numeric($insertResult), 'Empty string did not return assigned primary key');
-        
+
         // false (bool)
         $row['bug_id'] = false;
         $insertResult = $table->insert($row);
@@ -867,16 +867,16 @@ abstract class Zend_Db_Table_TestCommon extends Zend_Db_Table_TestSetup
         $row['bug_id'] = array();
         $insertResult = $table->insert($row);
         $this->assertTrue(is_numeric($insertResult), 'Empty array did not return assigned primary key');
-        
+
         // zero '0'
         $row['bug_id'] = '0';
         $table->delete('bug_id > 0'); // clear table
         $insertResult = $table->insert($row);
         $this->assertEquals('0', $insertResult, 'Zero string did not return assigned primary key');
-        
+
         // zero 0
         $row['bug_id'] = 0;
-        $table->delete('bug_id > 0'); // clear table
+        $table->delete('bug_id = 0'); // clear table
         $insertResult = $table->insert($row);
         $this->assertEquals('0', $insertResult, 'Zero int did not return assigned primary key');
     }

+ 1 - 1
tests/Zend/Db/TestSetup.php

@@ -42,7 +42,7 @@ require_once 'Zend/Db.php';
 abstract class Zend_Db_TestSetup extends PHPUnit_Framework_TestCase
 {
     /**
-     * @var Zend_Db_TestUtil
+     * @var Zend_Db_TestUtil_Common
      */
     protected $_util = null;
 

+ 2 - 2
tests/Zend/Db/TestUtil/Common.php

@@ -421,12 +421,12 @@ abstract class Zend_Db_TestUtil_Common
     protected function _getDataCascadeRecursive()
     {
         return array(
-            array('item_id' => '1', 'item_parent' => NULL, 'item_data' => '1'),
+            array('item_id' => '1', 'item_parent' => new Zend_Db_Expr('NULL'), 'item_data' => '1'),
             array('item_id' => '2', 'item_parent' => '1', 'item_data' => '1.2'),
             array('item_id' => '3', 'item_parent' => '1', 'item_data' => '1.3'),
             array('item_id' => '4', 'item_parent' => '3', 'item_data' => '1.3.4'),
             array('item_id' => '5', 'item_parent' => '3', 'item_data' => '1.3.5'),
-            array('item_id' => '6', 'item_parent' => NULL, 'item_data' => '6')
+            array('item_id' => '6', 'item_parent' => new Zend_Db_Expr('NULL'), 'item_data' => '6')
         );
     }
 

+ 2 - 2
tests/Zend/Test/PHPUnit/Db/Integration/MysqlIntegrationTest.php

@@ -57,8 +57,8 @@ class Zend_Test_PHPUnit_Db_Integration_MysqlIntegrationTest extends Zend_Test_PH
         );
 
         $this->dbAdapter = Zend_Db::factory('pdo_mysql', $params);
-        $this->dbAdapter->query("DROP TABLE foo");
-        $this->dbAdapter->query("DROP TABLE bar");
+        $this->dbAdapter->query("DROP TABLE IF EXISTS foo");
+        $this->dbAdapter->query("DROP TABLE IF EXISTS bar");
         $this->dbAdapter->query(
             'CREATE TABLE foo (id INT(10) AUTO_INCREMENT PRIMARY KEY, foo VARCHAR(255), bar VARCHAR(255), baz VARCHAR(255)) AUTO_INCREMENT=1'
         );