From f5fc3a6e5bcb033f3330b3a55458a3e2620d9fba Mon Sep 17 00:00:00 2001 From: zYne Date: Wed, 22 Nov 2006 00:19:23 +0000 Subject: [PATCH] added tests for pgsql export driver --- tests/ExportPgsqlTestCase.php | 66 +++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 tests/ExportPgsqlTestCase.php diff --git a/tests/ExportPgsqlTestCase.php b/tests/ExportPgsqlTestCase.php new file mode 100644 index 000000000..5f89ba7cd --- /dev/null +++ b/tests/ExportPgsqlTestCase.php @@ -0,0 +1,66 @@ +export->createDatabase('db'); + $this->fail(); + } catch(Doctrine_Export_Firebird_Exception $e) { + $this->pass(); + } + } + 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->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'); + } +} +?>