From: Chuck Hagenbuch Date: Wed, 6 Jan 2010 19:25:48 +0000 (-0500) Subject: Better test table cleanup X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=6ef9cfc1f53bbdf28e847f106867642f0aac9bda;p=horde.git Better test table cleanup --- diff --git a/framework/Db/test/Horde/Db/Adapter/MysqliTest.php b/framework/Db/test/Horde/Db/Adapter/MysqliTest.php index 3b1979dc0..8f30ee320 100644 --- a/framework/Db/test/Horde/Db/Adapter/MysqliTest.php +++ b/framework/Db/test/Horde/Db/Adapter/MysqliTest.php @@ -612,8 +612,6 @@ class Horde_Db_Adapter_MysqliTest extends PHPUnit_Framework_TestCase $this->assertEquals('http://www.foreverflying.com/octopus-black7.jpg', $this->_conn->selectValue("SELECT url FROM octopi WHERE id=1")); - $this->_conn->dropTable('octopi'); - // Make sure the old table name isn't still there try { $sql = "SELECT id FROM octopuses WHERE id = 1"; @@ -640,8 +638,6 @@ class Horde_Db_Adapter_MysqliTest extends PHPUnit_Framework_TestCase $indexes = $this->_conn->indexes('octopi'); $this->assertEquals('url', $indexes[0]->columns[0]); - - $this->_conn->dropTable('octopi'); } public function testDropTable() @@ -1255,27 +1251,23 @@ class Horde_Db_Adapter_MysqliTest extends PHPUnit_Framework_TestCase */ protected function _dropTestTables() { - try { - $this->_conn->dropTable('unit_tests'); - } catch (Exception $e) {} - try { - $this->_conn->dropTable('testings'); - } catch (Exception $e) {} - try { - $this->_conn->dropTable('users'); - } catch (Exception $e) {} - try { - $this->_conn->dropTable('sports'); - } catch (Exception $e) {} - try { - $this->_conn->dropTable('my_sports'); - } catch (Exception $e) {} - try { - $this->_conn->dropTable('schema_info'); - } catch (Exception $e) {} - try { - $this->_conn->dropTable('cache_table'); - } catch (Exception $e) {} + $tables = array( + 'binary_testings', + 'cache_table', + 'my_sports', + 'octopi', + 'schema_info', + 'sports', + 'testings', + 'unit_tests', + 'users', + ); + + foreach ($tables as $table) { + try { + $this->_conn->dropTable($table); + } catch (Exception $e) {} + } } protected function _columnNames($tableName) diff --git a/framework/Db/test/Horde/Db/Adapter/Pdo/MysqlTest.php b/framework/Db/test/Horde/Db/Adapter/Pdo/MysqlTest.php index 05a568aad..d06ace9cf 100644 --- a/framework/Db/test/Horde/Db/Adapter/Pdo/MysqlTest.php +++ b/framework/Db/test/Horde/Db/Adapter/Pdo/MysqlTest.php @@ -357,8 +357,6 @@ class Horde_Db_Adapter_Pdo_MysqlTest extends PHPUnit_Framework_TestCase // If these asserts fail, that means the INSERT (create function, or cast to SQL) is broken! $this->assertEquals($correctValue, $user->wealth); - - $this->_conn->dropTable('users'); } public function testNativeTypes() @@ -634,8 +632,6 @@ class Horde_Db_Adapter_Pdo_MysqlTest extends PHPUnit_Framework_TestCase $this->assertEquals('http://www.foreverflying.com/octopus-black7.jpg', $this->_conn->selectValue("SELECT url FROM octopi WHERE id=1")); - $this->_conn->dropTable('octopi'); - // Make sure the old table name isn't still there try { $sql = "SELECT id FROM octopuses WHERE id = 1"; @@ -662,8 +658,6 @@ class Horde_Db_Adapter_Pdo_MysqlTest extends PHPUnit_Framework_TestCase $indexes = $this->_conn->indexes('octopi'); $this->assertEquals('url', $indexes[0]->columns[0]); - - $this->_conn->dropTable('octopi'); } public function testDropTable() @@ -1278,27 +1272,23 @@ class Horde_Db_Adapter_Pdo_MysqlTest extends PHPUnit_Framework_TestCase */ protected function _dropTestTables() { - try { - $this->_conn->dropTable('unit_tests'); - } catch (Exception $e) {} - try { - $this->_conn->dropTable('testings'); - } catch (Exception $e) {} - try { - $this->_conn->dropTable('users'); - } catch (Exception $e) {} - try { - $this->_conn->dropTable('sports'); - } catch (Exception $e) {} - try { - $this->_conn->dropTable('my_sports'); - } catch (Exception $e) {} - try { - $this->_conn->dropTable('schema_info'); - } catch (Exception $e) {} - try { - $this->_conn->dropTable('cache_table'); - } catch (Exception $e) {} + $tables = array( + 'binary_testings', + 'cache_table', + 'my_sports', + 'octopi', + 'schema_info', + 'sports', + 'testings', + 'unit_tests', + 'users', + ); + + foreach ($tables as $table) { + try { + $this->_conn->dropTable($table); + } catch (Exception $e) {} + } } protected function _columnNames($tableName) diff --git a/framework/Db/test/Horde/Db/Adapter/Pdo/PgsqlTest.php b/framework/Db/test/Horde/Db/Adapter/Pdo/PgsqlTest.php index 0b2e2950b..237f0e32d 100644 --- a/framework/Db/test/Horde/Db/Adapter/Pdo/PgsqlTest.php +++ b/framework/Db/test/Horde/Db/Adapter/Pdo/PgsqlTest.php @@ -536,8 +536,6 @@ class Horde_Db_Adapter_Pdo_PgsqlTest extends PHPUnit_Framework_TestCase $this->assertEquals('http://www.foreverflying.com/octopus-black7.jpg', $this->_conn->selectValue("SELECT url FROM octopi WHERE id=1")); - $this->_conn->dropTable('octopi'); - // Make sure the old table name isn't still there try { $sql = "SELECT id FROM octopuses WHERE id = 1"; @@ -564,8 +562,6 @@ class Horde_Db_Adapter_Pdo_PgsqlTest extends PHPUnit_Framework_TestCase $indexes = $this->_conn->indexes('octopi'); $this->assertEquals('url', $indexes[0]->columns[0]); - - $this->_conn->dropTable('octopi'); } public function testDropTable() @@ -1148,27 +1144,23 @@ class Horde_Db_Adapter_Pdo_PgsqlTest extends PHPUnit_Framework_TestCase */ protected function _dropTestTables() { - try { - $this->_conn->dropTable('unit_tests'); - } catch (Exception $e) {} - try { - $this->_conn->dropTable('testings'); - } catch (Exception $e) {} - try { - $this->_conn->dropTable('users'); - } catch (Exception $e) {} - try { - $this->_conn->dropTable('sports'); - } catch (Exception $e) {} - try { - $this->_conn->dropTable('my_sports'); - } catch (Exception $e) {} - try { - $this->_conn->dropTable('schema_info'); - } catch (Exception $e) {} - try { - $this->_conn->dropTable('cache_table'); - } catch (Exception $e) {} + $tables = array( + 'binary_testings', + 'cache_table', + 'my_sports', + 'octopi', + 'schema_info', + 'sports', + 'testings', + 'unit_tests', + 'users', + ); + + foreach ($tables as $table) { + try { + $this->_conn->dropTable($table); + } catch (Exception $e) {} + } } protected function _columnNames($tableName)