Commit 982205b8 authored by lsmith's avatar lsmith

- fixed tests to expect DEFAULT NULL when no default is specified on nullable non lob columns

parent 88dfc987
......@@ -81,6 +81,6 @@ class Doctrine_Export_Firebird_TestCase extends Doctrine_UnitTestCase
$options = array('primary' => array('name', 'type'));
$this->export->createTable($name, $fields, $options);
$this->assertEqual($this->adapter->pop(), 'CREATE TABLE mytable (name CHAR(10), type INT, PRIMARY KEY(name, type))');
$this->assertEqual($this->adapter->pop(), 'CREATE TABLE mytable (name CHAR(10) DEFAULT NULL, type INT DEFAULT NULL, PRIMARY KEY(name, type))');
}
}
......@@ -56,7 +56,7 @@ class Doctrine_Export_Mysql_TestCase extends Doctrine_UnitTestCase
$this->export->createTable($name, $fields, $options);
$this->assertEqual($this->adapter->pop(), 'CREATE TABLE mytable (id INT UNSIGNED) ENGINE = MYISAM');
$this->assertEqual($this->adapter->pop(), 'CREATE TABLE mytable (id INT UNSIGNED DEFAULT NULL) ENGINE = MYISAM');
}
public function testCreateTableSupportsDefaultTableType()
{
......@@ -67,7 +67,7 @@ class Doctrine_Export_Mysql_TestCase extends Doctrine_UnitTestCase
$this->export->createTable($name, $fields);
// INNODB is the default type
$this->assertEqual($this->adapter->pop(), 'CREATE TABLE mytable (id INT UNSIGNED) ENGINE = INNODB');
$this->assertEqual($this->adapter->pop(), 'CREATE TABLE mytable (id INT UNSIGNED DEFAULT NULL) ENGINE = INNODB');
}
public function testCreateTableSupportsMultiplePks()
{
......@@ -78,7 +78,7 @@ class Doctrine_Export_Mysql_TestCase extends Doctrine_UnitTestCase
$options = array('primary' => array('name', 'type'));
$this->export->createTable($name, $fields, $options);
$this->assertEqual($this->adapter->pop(), 'CREATE TABLE mytable (name CHAR(10), type MEDIUMINT, PRIMARY KEY(name, type)) ENGINE = INNODB');
$this->assertEqual($this->adapter->pop(), 'CREATE TABLE mytable (name CHAR(10) DEFAULT NULL, type MEDIUMINT DEFAULT NULL, PRIMARY KEY(name, type)) ENGINE = INNODB');
}
public function testCreateTableSupportsAutoincPks()
{
......@@ -101,7 +101,7 @@ class Doctrine_Export_Mysql_TestCase extends Doctrine_UnitTestCase
$this->export->createTable($name, $fields, $options);
$this->assertEqual($this->adapter->pop(), 'CREATE TABLE mytable (id CHAR(3)) ENGINE = MYISAM');
$this->assertEqual($this->adapter->pop(), 'CREATE TABLE mytable (id CHAR(3) DEFAULT NULL) ENGINE = MYISAM');
}
public function testCreateTableSupportsCharType2()
{
......@@ -112,7 +112,7 @@ class Doctrine_Export_Mysql_TestCase extends Doctrine_UnitTestCase
$this->export->createTable($name, $fields, $options);
$this->assertEqual($this->adapter->pop(), 'CREATE TABLE mytable (id CHAR(255)) ENGINE = MYISAM');
$this->assertEqual($this->adapter->pop(), 'CREATE TABLE mytable (id CHAR(255) DEFAULT NULL) ENGINE = MYISAM');
}
public function testCreateTableSupportsVarcharType()
{
......@@ -123,7 +123,7 @@ class Doctrine_Export_Mysql_TestCase extends Doctrine_UnitTestCase
$this->export->createTable($name, $fields, $options);
$this->assertEqual($this->adapter->pop(), 'CREATE TABLE mytable (id VARCHAR(100)) ENGINE = MYISAM');
$this->assertEqual($this->adapter->pop(), 'CREATE TABLE mytable (id VARCHAR(100) DEFAULT NULL) ENGINE = MYISAM');
}
public function testCreateTableSupportsIntegerType()
{
......@@ -134,7 +134,7 @@ class Doctrine_Export_Mysql_TestCase extends Doctrine_UnitTestCase
$this->export->createTable($name, $fields, $options);
$this->assertEqual($this->adapter->pop(), 'CREATE TABLE mytable (id BIGINT) ENGINE = MYISAM');
$this->assertEqual($this->adapter->pop(), 'CREATE TABLE mytable (id BIGINT DEFAULT NULL) ENGINE = MYISAM');
}
public function testCreateTableSupportsBlobType()
{
......@@ -168,7 +168,7 @@ class Doctrine_Export_Mysql_TestCase extends Doctrine_UnitTestCase
$this->export->createTable($name, $fields, $options);
$this->assertEqual($this->adapter->pop(), 'CREATE TABLE mytable (id TINYINT(1)) ENGINE = MYISAM');
$this->assertEqual($this->adapter->pop(), 'CREATE TABLE mytable (id TINYINT(1) DEFAULT NULL) ENGINE = MYISAM');
}
public function testCreateTableSupportsForeignKeys()
{
......@@ -186,7 +186,7 @@ class Doctrine_Export_Mysql_TestCase extends Doctrine_UnitTestCase
$sql = $this->export->createTableSql($name, $fields, $options);
$this->assertEqual($sql[0], 'CREATE TABLE mytable (id TINYINT(1), foreignKey INT, INDEX foreignKey_idx (foreignKey)) ENGINE = INNODB');
$this->assertEqual($sql[0], 'CREATE TABLE mytable (id TINYINT(1) DEFAULT NULL, foreignKey INT DEFAULT NULL, INDEX foreignKey_idx (foreignKey)) ENGINE = INNODB');
$this->assertEqual($sql[1], 'ALTER TABLE mytable ADD FOREIGN KEY (foreignKey) REFERENCES sometable(id)');
}
public function testForeignKeyIdentifierQuoting()
......@@ -207,7 +207,7 @@ class Doctrine_Export_Mysql_TestCase extends Doctrine_UnitTestCase
$sql = $this->export->createTableSql($name, $fields, $options);
$this->assertEqual($sql[0], 'CREATE TABLE `mytable` (`id` TINYINT(1), `foreignKey` INT, INDEX `foreignKey_idx` (`foreignKey`)) ENGINE = INNODB');
$this->assertEqual($sql[0], 'CREATE TABLE `mytable` (`id` TINYINT(1) DEFAULT NULL, `foreignKey` INT DEFAULT NULL, INDEX `foreignKey_idx` (`foreignKey`)) ENGINE = INNODB');
$this->assertEqual($sql[1], 'ALTER TABLE `mytable` ADD FOREIGN KEY (`foreignKey`) REFERENCES `sometable`(`id`)');
$this->conn->setAttribute(Doctrine::ATTR_QUOTE_IDENTIFIER, false);
......@@ -230,7 +230,7 @@ class Doctrine_Export_Mysql_TestCase extends Doctrine_UnitTestCase
//and then the index so i replaced it with the ones below
//$this->assertEqual($var, 'CREATE TABLE sometable (id INTEGER PRIMARY KEY AUTOINCREMENT, name VARCHAR(4), INDEX myindex (id, name))');
$this->assertEqual($this->adapter->pop(), 'CREATE TABLE `sometable` (`id` INT UNSIGNED AUTO_INCREMENT, `name` VARCHAR(4), INDEX `myindex_idx` (`id`, `name`), PRIMARY KEY(`id`)) ENGINE = INNODB');
$this->assertEqual($this->adapter->pop(), 'CREATE TABLE `sometable` (`id` INT UNSIGNED AUTO_INCREMENT, `name` VARCHAR(4) DEFAULT NULL, INDEX `myindex_idx` (`id`, `name`), PRIMARY KEY(`id`)) ENGINE = INNODB');
$this->conn->setAttribute(Doctrine::ATTR_QUOTE_IDENTIFIER, false);
}
......@@ -250,7 +250,7 @@ class Doctrine_Export_Mysql_TestCase extends Doctrine_UnitTestCase
$sql = $this->export->createTableSql($name, $fields, $options);
$this->assertEqual($sql[0], 'CREATE TABLE mytable (id TINYINT(1), foreignKey INT, INDEX myindex_idx (foreignKey)) ENGINE = INNODB');
$this->assertEqual($sql[0], 'CREATE TABLE mytable (id TINYINT(1) DEFAULT NULL, foreignKey INT DEFAULT NULL, INDEX myindex_idx (foreignKey)) ENGINE = INNODB');
$this->assertEqual($sql[1], 'ALTER TABLE mytable ADD FOREIGN KEY (foreignKey) REFERENCES sometable(id)');
}
public function testCreateDatabaseExecutesSql()
......@@ -303,7 +303,7 @@ class Doctrine_Export_Mysql_TestCase extends Doctrine_UnitTestCase
);
$this->export->createTable('sometable', $fields, $options);
$this->assertEqual($this->adapter->pop(), 'CREATE TABLE sometable (id INT UNSIGNED AUTO_INCREMENT, name VARCHAR(4), INDEX myindex_idx (name), PRIMARY KEY(id)) ENGINE = INNODB');
$this->assertEqual($this->adapter->pop(), 'CREATE TABLE sometable (id INT UNSIGNED AUTO_INCREMENT, name VARCHAR(4) DEFAULT NULL, INDEX myindex_idx (name), PRIMARY KEY(id)) ENGINE = INNODB');
}
public function testCreateTableSupportsIndexesWithCustomSorting()
{
......@@ -322,7 +322,7 @@ class Doctrine_Export_Mysql_TestCase extends Doctrine_UnitTestCase
$this->export->createTable('sometable', $fields, $options);
$this->assertEqual($this->adapter->pop(), 'CREATE TABLE sometable (id INT UNSIGNED AUTO_INCREMENT, name VARCHAR(4), INDEX myindex_idx (id ASC, name DESC), PRIMARY KEY(id)) ENGINE = INNODB');
$this->assertEqual($this->adapter->pop(), 'CREATE TABLE sometable (id INT UNSIGNED AUTO_INCREMENT, name VARCHAR(4) DEFAULT NULL, INDEX myindex_idx (id ASC, name DESC), PRIMARY KEY(id)) ENGINE = INNODB');
}
public function testCreateTableSupportsFulltextIndexes()
{
......@@ -342,6 +342,6 @@ class Doctrine_Export_Mysql_TestCase extends Doctrine_UnitTestCase
$this->export->createTable('sometable', $fields, $options);
$this->assertEqual($this->adapter->pop(), 'CREATE TABLE sometable (id INT UNSIGNED AUTO_INCREMENT, content VARCHAR(4), FULLTEXT INDEX myindex_idx (content DESC), PRIMARY KEY(id)) ENGINE = MYISAM');
$this->assertEqual($this->adapter->pop(), 'CREATE TABLE sometable (id INT UNSIGNED AUTO_INCREMENT, content VARCHAR(4) DEFAULT NULL, FULLTEXT INDEX myindex_idx (content DESC), PRIMARY KEY(id)) ENGINE = MYISAM');
}
}
......@@ -63,7 +63,7 @@ class Doctrine_Export_Oracle_TestCase extends Doctrine_UnitTestCase
$this->export->createTable($name, $fields);
$this->assertEqual($this->adapter->pop(), 'COMMIT');
$this->assertEqual($this->adapter->pop(), 'CREATE TABLE mytable (id INT)');
$this->assertEqual($this->adapter->pop(), 'CREATE TABLE mytable (id INT DEFAULT NULL)');
$this->assertEqual($this->adapter->pop(), 'BEGIN TRANSACTION');
}
public function testCreateTableSupportsDefaultAttribute()
......@@ -92,7 +92,7 @@ class Doctrine_Export_Oracle_TestCase extends Doctrine_UnitTestCase
$this->assertEqual($this->adapter->pop(), 'COMMIT');
$this->assertEqual($this->adapter->pop(), 'CREATE TABLE mytable (name CHAR(10), type NUMBER(3), PRIMARY KEY(name, type))');
$this->assertEqual($this->adapter->pop(), 'CREATE TABLE mytable (name CHAR(10) DEFAULT NULL, type NUMBER(3) DEFAULT NULL, PRIMARY KEY(name, type))');
$this->assertEqual($this->adapter->pop(), 'BEGIN TRANSACTION');
}
public function testCreateTableSupportsAutoincPks()
......@@ -108,7 +108,7 @@ class Doctrine_Export_Oracle_TestCase extends Doctrine_UnitTestCase
$this->assertEqual(substr($this->adapter->pop(),0, 14), 'CREATE TRIGGER');
$this->assertEqual($this->adapter->pop(), 'CREATE SEQUENCE MYTABLE_seq START WITH 1 INCREMENT BY 1 NOCACHE');
$this->assertEqual($this->adapter->pop(), 'ALTER TABLE MYTABLE ADD CONSTRAINT MYTABLE_AI_PK_idx PRIMARY KEY (id)');
$this->assertEqual($this->adapter->pop(), 'CREATE TABLE mytable (id INT)');
$this->assertEqual($this->adapter->pop(), 'CREATE TABLE mytable (id INT DEFAULT NULL)');
$this->assertEqual($this->adapter->pop(), 'BEGIN TRANSACTION');
}
......@@ -121,7 +121,7 @@ class Doctrine_Export_Oracle_TestCase extends Doctrine_UnitTestCase
$this->export->createTable($name, $fields);
$this->adapter->pop();
$this->assertEqual($this->adapter->pop(), 'CREATE TABLE mytable (id CHAR(3))');
$this->assertEqual($this->adapter->pop(), 'CREATE TABLE mytable (id CHAR(3) DEFAULT NULL)');
}
public function testCreateTableSupportsUniqueConstraint()
{
......@@ -134,7 +134,7 @@ class Doctrine_Export_Oracle_TestCase extends Doctrine_UnitTestCase
$sql = $this->export->createTableSql('sometable', $fields, $options);
$this->assertEqual($sql[0], 'CREATE TABLE sometable (id INT UNIQUE, name VARCHAR2(4), PRIMARY KEY(id))');
$this->assertEqual($sql[0], 'CREATE TABLE sometable (id INT DEFAULT NULL UNIQUE, name VARCHAR2(4) DEFAULT NULL, PRIMARY KEY(id))');
}
public function testCreateTableSupportsIndexes()
{
......@@ -148,6 +148,6 @@ class Doctrine_Export_Oracle_TestCase extends Doctrine_UnitTestCase
$sql = $this->export->createTableSql('sometable', $fields, $options);
$this->assertEqual($sql[0], 'CREATE TABLE sometable (id INT UNIQUE, name VARCHAR2(4), PRIMARY KEY(id), INDEX myindex (id, name))');
$this->assertEqual($sql[0], 'CREATE TABLE sometable (id INT DEFAULT NULL UNIQUE, name VARCHAR2(4) DEFAULT NULL, PRIMARY KEY(id), INDEX myindex (id, name))');
}
}
......@@ -74,7 +74,7 @@ class Doctrine_Export_Pgsql_TestCase extends Doctrine_UnitTestCase
$options = array('primary' => array('name', 'type'));
$this->export->createTable($name, $fields, $options);
$this->assertEqual($this->adapter->pop(), 'CREATE TABLE "mytable" ("name" CHAR(10), "type" INT, PRIMARY KEY("name", "type"))');
$this->assertEqual($this->adapter->pop(), 'CREATE TABLE "mytable" ("name" CHAR(10) DEFAULT NULL, "type" INT, PRIMARY KEY("name", "type"))');
$this->conn->setAttribute(Doctrine::ATTR_QUOTE_IDENTIFIER, false);
}
......@@ -95,7 +95,7 @@ class Doctrine_Export_Pgsql_TestCase extends Doctrine_UnitTestCase
$sql = $this->export->createTableSql($name, $fields, $options);
$this->assertEqual($sql[0], 'CREATE TABLE "mytable" ("id" BOOLEAN, "foreignKey" INT)');
$this->assertEqual($sql[0], 'CREATE TABLE "mytable" ("id" BOOLEAN DEFAULT NULL, "foreignKey" INT)');
$this->assertEqual($sql[1], 'ALTER TABLE "mytable" ADD FOREIGN KEY ("foreignKey") REFERENCES "sometable"("id") NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->conn->setAttribute(Doctrine::ATTR_QUOTE_IDENTIFIER, false);
......@@ -121,7 +121,7 @@ class Doctrine_Export_Pgsql_TestCase extends Doctrine_UnitTestCase
$options = array('primary' => array('name', 'type'));
$this->export->createTable($name, $fields, $options);
$this->assertEqual($this->adapter->pop(), 'CREATE TABLE mytable (name CHAR(10), type INT, PRIMARY KEY(name, type))');
$this->assertEqual($this->adapter->pop(), 'CREATE TABLE mytable (name CHAR(10) DEFAULT NULL, type INT, PRIMARY KEY(name, type))');
}
public function testExportSql()
{
......@@ -129,12 +129,12 @@ class Doctrine_Export_Pgsql_TestCase extends Doctrine_UnitTestCase
//dirname(__FILE__) . DIRECTORY_SEPARATOR . '_files');
$this->assertEqual($sql, array ( 0 => 'CREATE TABLE foo_reference (foo1 BIGINT, foo2 BIGINT, PRIMARY KEY(foo1, foo2))',
1 => 'CREATE TABLE foo_locally_owned (id BIGSERIAL, name VARCHAR(200), PRIMARY KEY(id))',
2 => 'CREATE TABLE foo_foreignly_owned_with_pk (id BIGSERIAL, name VARCHAR(200), PRIMARY KEY(id))',
3 => 'CREATE TABLE foo_foreignly_owned (id BIGSERIAL, name VARCHAR(200), fooid BIGINT, PRIMARY KEY(id))',
1 => 'CREATE TABLE foo_locally_owned (id BIGSERIAL, name VARCHAR(200) DEFAULT NULL, PRIMARY KEY(id))',
2 => 'CREATE TABLE foo_foreignly_owned_with_pk (id BIGSERIAL, name VARCHAR(200) DEFAULT NULL, PRIMARY KEY(id))',
3 => 'CREATE TABLE foo_foreignly_owned (id BIGSERIAL, name VARCHAR(200) DEFAULT NULL, fooid BIGINT, PRIMARY KEY(id))',
4 => 'CREATE TABLE foo_bar_record (fooid BIGINT, barid BIGINT, PRIMARY KEY(fooid, barid))',
5 => 'CREATE TABLE foo (id BIGSERIAL, name VARCHAR(200) NOT NULL, parent_id BIGINT, local_foo BIGINT, PRIMARY KEY(id))',
6 => 'CREATE TABLE bar (id BIGSERIAL, name VARCHAR(200), PRIMARY KEY(id))',
6 => 'CREATE TABLE bar (id BIGSERIAL, name VARCHAR(200) DEFAULT NULL, PRIMARY KEY(id))',
7 => 'ALTER TABLE foo_reference ADD FOREIGN KEY (foo1) REFERENCES foo(id) NOT DEFERRABLE INITIALLY IMMEDIATE',
8 => 'ALTER TABLE foo_bar_record ADD FOREIGN KEY (fooId) REFERENCES foo(id) NOT DEFERRABLE INITIALLY IMMEDIATE',
9 => 'ALTER TABLE foo ADD FOREIGN KEY (parent_id) REFERENCES foo(id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE',
......
......@@ -49,7 +49,7 @@ class Doctrine_Export_Record_TestCase extends Doctrine_UnitTestCase
{
$sql = $this->conn->export->exportClassesSql(array('ForeignKeyTest'));
$this->assertEqual($sql[0], 'CREATE TABLE foreign_key_test (id BIGINT AUTO_INCREMENT, name TEXT, code INT, content TEXT, parent_id BIGINT, INDEX parent_id_idx (parent_id), PRIMARY KEY(id)) ENGINE = INNODB');
$this->assertEqual($sql[0], 'CREATE TABLE foreign_key_test (id BIGINT AUTO_INCREMENT, name TEXT DEFAULT NULL, code INT DEFAULT NULL, content TEXT DEFAULT NULL, parent_id BIGINT DEFAULT NULL, INDEX parent_id_idx (parent_id), PRIMARY KEY(id)) ENGINE = INNODB');
if (isset($sql[1])) {
$this->assertEqual($sql[1], 'ALTER TABLE foreign_key_test ADD FOREIGN KEY (parent_id) REFERENCES foreign_key_test(id) ON UPDATE RESTRICT ON DELETE CASCADE');
} else {
......@@ -61,21 +61,21 @@ class Doctrine_Export_Record_TestCase extends Doctrine_UnitTestCase
{
$sql = $this->conn->export->exportClassesSql(array('MysqlIndexTestRecord'));
$this->assertEqual($sql[0], 'CREATE TABLE mysql_index_test_record (id BIGINT AUTO_INCREMENT, name TEXT, code INT, content TEXT, FULLTEXT INDEX content_idx (content), UNIQUE INDEX namecode_idx (name, code), PRIMARY KEY(id)) ENGINE = MYISAM');
$this->assertEqual($sql[0], 'CREATE TABLE mysql_index_test_record (id BIGINT AUTO_INCREMENT, name TEXT DEFAULT NULL, code INT DEFAULT NULL, content TEXT DEFAULT NULL, FULLTEXT INDEX content_idx (content), UNIQUE INDEX namecode_idx (name, code), PRIMARY KEY(id)) ENGINE = MYISAM');
}
public function testRecordDefinitionsSupportTableOptions()
{
$sql = $this->conn->export->exportClassesSql(array('MysqlTestRecord'));
$this->assertEqual($sql[0], 'CREATE TABLE mysql_test_record (name TEXT, code BIGINT, PRIMARY KEY(name, code)) ENGINE = INNODB');
$this->assertEqual($sql[0], 'CREATE TABLE mysql_test_record (name TEXT DEFAULT NULL, code BIGINT DEFAULT NULL, PRIMARY KEY(name, code)) ENGINE = INNODB');
}
public function testExportSupportsForeignKeysWithoutAttributes()
{
$sql = $this->conn->export->exportClassesSql(array('ForeignKeyTest'));
$this->assertEqual($sql[0], 'CREATE TABLE foreign_key_test (id BIGINT AUTO_INCREMENT, name TEXT, code INT, content TEXT, parent_id BIGINT, INDEX parent_id_idx (parent_id), PRIMARY KEY(id)) ENGINE = INNODB');
$this->assertEqual($sql[0], 'CREATE TABLE foreign_key_test (id BIGINT AUTO_INCREMENT, name TEXT DEFAULT NULL, code INT DEFAULT NULL, content TEXT DEFAULT NULL, parent_id BIGINT DEFAULT NULL, INDEX parent_id_idx (parent_id), PRIMARY KEY(id)) ENGINE = INNODB');
if (isset($sql[1])) {
$this->assertEqual($sql[1], 'ALTER TABLE foreign_key_test ADD FOREIGN KEY (parent_id) REFERENCES foreign_key_test(id) ON UPDATE RESTRICT ON DELETE CASCADE');
} else {
......@@ -87,25 +87,20 @@ class Doctrine_Export_Record_TestCase extends Doctrine_UnitTestCase
{
$sql = $this->conn->export->exportClassesSql(array('MysqlUser'));
$this->assertEqual($sql[0], 'CREATE TABLE mysql_user (id BIGINT AUTO_INCREMENT, name TEXT, PRIMARY KEY(id)) ENGINE = INNODB');
$this->assertEqual($sql[0], 'CREATE TABLE mysql_user (id BIGINT AUTO_INCREMENT, name TEXT DEFAULT NULL, PRIMARY KEY(id)) ENGINE = INNODB');
$sql = $this->conn->export->exportClassesSql(array('MysqlGroup'));
$this->assertEqual($sql[0], 'CREATE TABLE mysql_group (id BIGINT AUTO_INCREMENT, name TEXT, PRIMARY KEY(id)) ENGINE = INNODB');
$this->assertEqual($sql[0], 'CREATE TABLE mysql_group (id BIGINT AUTO_INCREMENT, name TEXT DEFAULT NULL, PRIMARY KEY(id)) ENGINE = INNODB');
}
public function testExportModelFromDirectory()
{
Doctrine::createTablesFromModels(dirname(__FILE__) . DIRECTORY_SEPARATOR .'..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'models' . DIRECTORY_SEPARATOR . 'export');
$this->assertEqual($this->adapter->pop(), 'COMMIT');
$this->assertEqual($this->adapter->pop(), 'ALTER TABLE cms__category_languages ADD FOREIGN KEY (category_id) REFERENCES cms__category(id) ON DELETE CASCADE');
$createTableSql = array(
'CREATE TABLE cms__category_languages (id BIGINT AUTO_INCREMENT, name TEXT, category_id BIGINT, language_id BIGINT, INDEX index_category_idx (category_id), INDEX index_language_idx (language_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = INNODB',
'CREATE TABLE cms__category (id BIGINT AUTO_INCREMENT, created DATETIME, parent BIGINT, position MEDIUMINT, active BIGINT, INDEX index_parent_idx (parent), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = INNODB'
);
$this->assertTrue(in_array($this->adapter->pop(), $createTableSql));
$this->assertTrue(in_array($this->adapter->pop(), $createTableSql));
$this->assertTrue($this->adapter->pop(), 'CREATE TABLE cms__category_languages (id BIGINT AUTO_INCREMENT, name TEXT DEFAULT NULL, category_id BIGINT DEFAULT NULL, language_id BIGINT DEFAULT NULL, INDEX index_category_idx (category_id), INDEX index_language_idx (language_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = INNODB');
$this->assertTrue($this->adapter->pop(), 'CREATE TABLE cms__category (id BIGINT AUTO_INCREMENT, created DATETIME DEFAULT NULL, parent BIGINT DEFAULT NULL, position MEDIUMINT DEFAULT NULL, active BIGINT DEFAULT NULL, INDEX index_parent_idx (parent), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = INNODB');
$this->assertEqual($this->adapter->pop(), 'BEGIN TRANSACTION');
}
......
......@@ -81,7 +81,7 @@ class Doctrine_Export_Sqlite_TestCase extends Doctrine_UnitTestCase
$options = array('primary' => array('name', 'type'));
$this->export->createTable($name, $fields, $options);
$this->assertEqual($this->adapter->pop(), 'CREATE TABLE mytable (name CHAR(10), type INTEGER, PRIMARY KEY(name, type))');
$this->assertEqual($this->adapter->pop(), 'CREATE TABLE mytable (name CHAR(10) DEFAULT NULL, type INTEGER, PRIMARY KEY(name, type))');
}
public function testCreateTableSupportsIndexes()
{
......@@ -101,7 +101,7 @@ class Doctrine_Export_Sqlite_TestCase extends Doctrine_UnitTestCase
$this->assertEqual($this->adapter->pop(),"CREATE INDEX myindex_idx ON sometable (id, name)");
$this->assertEqual($this->adapter->pop(), 'CREATE TABLE sometable (id INTEGER PRIMARY KEY AUTOINCREMENT, name VARCHAR(4))');
$this->assertEqual($this->adapter->pop(), 'CREATE TABLE sometable (id INTEGER PRIMARY KEY AUTOINCREMENT, name VARCHAR(4) DEFAULT NULL)');
}
public function testIdentifierQuoting()
{
......@@ -123,7 +123,7 @@ class Doctrine_Export_Sqlite_TestCase extends Doctrine_UnitTestCase
$this->assertEqual($this->adapter->pop(),'CREATE INDEX "myindex_idx" ON "sometable" ("id", "name")');
$this->assertEqual($this->adapter->pop(), 'CREATE TABLE "sometable" ("id" INTEGER PRIMARY KEY AUTOINCREMENT, "name" VARCHAR(4))');
$this->assertEqual($this->adapter->pop(), 'CREATE TABLE "sometable" ("id" INTEGER PRIMARY KEY AUTOINCREMENT, "name" VARCHAR(4) DEFAULT NULL)');
$this->conn->setAttribute(Doctrine::ATTR_QUOTE_IDENTIFIER, false);
}
......@@ -138,7 +138,7 @@ class Doctrine_Export_Sqlite_TestCase extends Doctrine_UnitTestCase
$options = array('primary' => array('name', 'type'));
$this->export->createTable($name, $fields, $options);
$this->assertEqual($this->adapter->pop(), 'CREATE TABLE "mytable" ("name" CHAR(10), "type" INTEGER, PRIMARY KEY("name", "type"))');
$this->assertEqual($this->adapter->pop(), 'CREATE TABLE "mytable" ("name" CHAR(10) DEFAULT NULL, "type" INTEGER, PRIMARY KEY("name", "type"))');
$this->conn->setAttribute(Doctrine::ATTR_QUOTE_IDENTIFIER, false);
}
......@@ -176,7 +176,7 @@ class Doctrine_Export_Sqlite_TestCase extends Doctrine_UnitTestCase
$this->assertEqual($this->adapter->pop(),"CREATE INDEX myindex_idx ON sometable (id ASC, name DESC)");
$this->assertEqual($this->adapter->pop(), 'CREATE TABLE sometable (id INTEGER PRIMARY KEY AUTOINCREMENT, name VARCHAR(4))');
$this->assertEqual($this->adapter->pop(), 'CREATE TABLE sometable (id INTEGER PRIMARY KEY AUTOINCREMENT, name VARCHAR(4) DEFAULT NULL)');
}
......
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