Commit ee5a7f8c authored by zYne's avatar zYne

Added super class for all export test cases

parent f5fc3a6e
<?php
class Doctrine_Export_Firebird_TestCase extends Doctrine_Driver_UnitTestCase {
class Doctrine_Export_Firebird_TestCase extends Doctrine_Export_TestCase {
public function __construct() {
parent::__construct('firebird');
}
......@@ -11,7 +11,7 @@ class Doctrine_Export_Firebird_TestCase extends Doctrine_Driver_UnitTestCase {
$this->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');
}
}
?>
<?php
class Doctrine_Export_Mysql_TestCase extends Doctrine_Driver_UnitTestCase {
class Doctrine_Export_Mysql_TestCase extends Doctrine_Export_TestCase {
public function __construct() {
parent::__construct('mysql');
}
......@@ -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');
}
}
?>
<?php
class Doctrine_Export_Pgsql_TestCase extends Doctrine_Driver_UnitTestCase {
class Doctrine_Export_Pgsql_TestCase extends Doctrine_Export_TestCase {
public function __construct() {
parent::__construct('pgsql');
}
public function testCreateDatabaseDoesNotExecuteSql() {
try {
public function testCreateDatabaseExecutesSql() {
$this->export->createDatabase('db');
$this->fail();
} catch(Doctrine_Export_Firebird_Exception $e) {
$this->pass();
}
$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->fail();
} catch(Doctrine_Export_Exception $e) {
$this->pass();
}
$this->assertEqual($this->adapter->pop(), 'DROP DATABASE db');
}
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');
}
}
?>
<?php
class Doctrine_Export_TestCase extends Doctrine_Driver_UnitTestCase {
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');
}
public function testDropTableExecutesSql() {
$this->export->dropTable('sometable');
$this->assertEqual($this->adapter->pop(), 'DROP TABLE sometable');
}
}
?>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment