From ee5a7f8c1bc7e03ba15c9fafda0c01991d822646 Mon Sep 17 00:00:00 2001 From: zYne Date: Wed, 22 Nov 2006 00:26:34 +0000 Subject: [PATCH] Added super class for all export test cases --- tests/ExportFirebirdTestCase.php | 46 ++---------------------- tests/ExportMysqlTestCase.php | 41 ++------------------- tests/ExportPgsqlTestCase.php | 62 ++++---------------------------- tests/ExportTestCase.php | 48 +++++++++++++++++++++++++ 4 files changed, 59 insertions(+), 138 deletions(-) create mode 100644 tests/ExportTestCase.php diff --git a/tests/ExportFirebirdTestCase.php b/tests/ExportFirebirdTestCase.php index c30c0b69b..f13508a14 100644 --- a/tests/ExportFirebirdTestCase.php +++ b/tests/ExportFirebirdTestCase.php @@ -1,5 +1,5 @@ pass(); } } - public function testDropDatabaseExecutesSql() { + public function testDropDatabaseDoesNotExecuteSql() { try { $this->export->dropDatabase('db'); $this->fail(); @@ -19,48 +19,6 @@ class Doctrine_Export_Firebird_TestCase extends Doctrine_Driver_UnitTestCase { $this->pass(); } } - public function testAlterTableThrowsExceptionWithoutValidTableName() { - try { - $this->export->alterTable(0,0,array()); - $this->fail(); - } catch(Doctrine_Export_Exception $e) { - $this->pass(); - } - } - public function testCreateTableThrowsExceptionWithoutValidTableName() { - try { - $this->export->createTable(0,array(),array()); - - $this->fail(); - } catch(Doctrine_Export_Exception $e) { - $this->pass(); - } - } - public function testCreateTableThrowsExceptionWithEmptyFieldsArray() { - try { - $this->export->createTable('sometable',array(),array()); - - $this->fail(); - } catch(Doctrine_Export_Exception $e) { - $this->pass(); - } - } - public function testCreateIndexExecutesSql() { - $this->export->createIndex('sometable', 'relevancy', array('fields' => array('title' => array(), 'content' => array()))); - - $this->assertEqual($this->adapter->pop(), 'CREATE INDEX relevancy ON sometable (title, content)'); - } - - public function testDropIndexExecutesSql() { - $this->export->dropIndex('sometable', 'relevancy'); - - $this->assertEqual($this->adapter->pop(), 'DROP INDEX relevancy ON sometable'); - } - public function testDropTableExecutesSql() { - $this->export->dropTable('sometable'); - - $this->assertEqual($this->adapter->pop(), 'DROP TABLE sometable'); - } } ?> diff --git a/tests/ExportMysqlTestCase.php b/tests/ExportMysqlTestCase.php index d08917245..018c8e0ab 100644 --- a/tests/ExportMysqlTestCase.php +++ b/tests/ExportMysqlTestCase.php @@ -1,8 +1,8 @@ export->createDatabase('db'); @@ -13,48 +13,11 @@ class Doctrine_Export_Mysql_TestCase extends Doctrine_Driver_UnitTestCase { $this->assertEqual($this->adapter->pop(), 'DROP DATABASE db'); } - public function testAlterTableThrowsExceptionWithoutValidTableName() { - try { - $this->export->alterTable(0,0,array()); - - $this->fail(); - } catch(Doctrine_Export_Exception $e) { - $this->pass(); - } - } - public function testCreateTableThrowsExceptionWithoutValidTableName() { - try { - $this->export->createTable(0,array(),array()); - - $this->fail(); - } catch(Doctrine_Export_Exception $e) { - $this->pass(); - } - } - public function testCreateTableThrowsExceptionWithEmptyFieldsArray() { - try { - $this->export->createTable('sometable',array(),array()); - - $this->fail(); - } catch(Doctrine_Export_Exception $e) { - $this->pass(); - } - } - public function testCreateIndexExecutesSql() { - $this->export->createIndex('sometable', 'relevancy', array('fields' => array('title' => array(), 'content' => array()))); - - $this->assertEqual($this->adapter->pop(), 'CREATE INDEX relevancy ON sometable (title, content)'); - } public function testDropIndexExecutesSql() { $this->export->dropIndex('sometable', 'relevancy'); $this->assertEqual($this->adapter->pop(), 'DROP INDEX relevancy ON sometable'); } - public function testDropTableExecutesSql() { - $this->export->dropTable('sometable'); - - $this->assertEqual($this->adapter->pop(), 'DROP TABLE sometable'); - } } ?> diff --git a/tests/ExportPgsqlTestCase.php b/tests/ExportPgsqlTestCase.php index 5f89ba7cd..3a476de5d 100644 --- a/tests/ExportPgsqlTestCase.php +++ b/tests/ExportPgsqlTestCase.php @@ -1,66 +1,18 @@ export->createDatabase('db'); - $this->fail(); - } catch(Doctrine_Export_Firebird_Exception $e) { - $this->pass(); - } + public function testCreateDatabaseExecutesSql() { + $this->export->createDatabase('db'); + + $this->assertEqual($this->adapter->pop(), 'CREATE DATABASE db'); } public function testDropDatabaseExecutesSql() { - try { - $this->export->dropDatabase('db'); - $this->fail(); - } catch(Doctrine_Export_Firebird_Exception $e) { - $this->pass(); - } - } - public function testAlterTableThrowsExceptionWithoutValidTableName() { - try { - $this->export->alterTable(0,0,array()); + $this->export->dropDatabase('db'); - $this->fail(); - } catch(Doctrine_Export_Exception $e) { - $this->pass(); - } - } - public function testCreateTableThrowsExceptionWithoutValidTableName() { - try { - $this->export->createTable(0,array(),array()); - - $this->fail(); - } catch(Doctrine_Export_Exception $e) { - $this->pass(); - } - } - public function testCreateTableThrowsExceptionWithEmptyFieldsArray() { - try { - $this->export->createTable('sometable',array(),array()); - - $this->fail(); - } catch(Doctrine_Export_Exception $e) { - $this->pass(); - } - } - public function testCreateIndexExecutesSql() { - $this->export->createIndex('sometable', 'relevancy', array('fields' => array('title' => array(), 'content' => array()))); - - $this->assertEqual($this->adapter->pop(), 'CREATE INDEX relevancy ON sometable (title, content)'); + $this->assertEqual($this->adapter->pop(), 'DROP DATABASE db'); } - public function testDropIndexExecutesSql() { - $this->export->dropIndex('sometable', 'relevancy'); - - $this->assertEqual($this->adapter->pop(), 'DROP INDEX relevancy ON sometable'); - } - public function testDropTableExecutesSql() { - $this->export->dropTable('sometable'); - - $this->assertEqual($this->adapter->pop(), 'DROP TABLE sometable'); - } } ?> diff --git a/tests/ExportTestCase.php b/tests/ExportTestCase.php new file mode 100644 index 000000000..576218a16 --- /dev/null +++ b/tests/ExportTestCase.php @@ -0,0 +1,48 @@ +export->alterTable(0,0,array()); + + $this->fail(); + } catch(Doctrine_Export_Exception $e) { + $this->pass(); + } + } + public function testCreateTableThrowsExceptionWithoutValidTableName() { + try { + $this->export->createTable(0,array(),array()); + + $this->fail(); + } catch(Doctrine_Export_Exception $e) { + $this->pass(); + } + } + public function testCreateTableThrowsExceptionWithEmptyFieldsArray() { + try { + $this->export->createTable('sometable',array(),array()); + + $this->fail(); + } catch(Doctrine_Export_Exception $e) { + $this->pass(); + } + } + public function testCreateIndexExecutesSql() { + $this->export->createIndex('sometable', 'relevancy', array('fields' => array('title' => array(), 'content' => array()))); + + $this->assertEqual($this->adapter->pop(), 'CREATE INDEX relevancy ON sometable (title, content)'); + } + + public function testDropIndexExecutesSql() { + $this->export->dropIndex('sometable', 'relevancy'); + + $this->assertEqual($this->adapter->pop(), 'DROP INDEX relevancy'); + } + public function testDropTableExecutesSql() { + $this->export->dropTable('sometable'); + + $this->assertEqual($this->adapter->pop(), 'DROP TABLE sometable'); + } +} +?>