1
0
mirror of synced 2025-01-20 07:21:40 +03:00
This commit is contained in:
zYne 2007-06-18 18:23:42 +00:00
parent 8784fe6644
commit d938e6a9b0

View File

@ -30,8 +30,10 @@
* @since 1.0
* @version $Revision$
*/
class Doctrine_Export_Sqlite_TestCase extends Doctrine_UnitTestCase {
public function testCreateDatabaseDoesNotExecuteSql() {
class Doctrine_Export_Sqlite_TestCase extends Doctrine_UnitTestCase
{
public function testCreateDatabaseDoesNotExecuteSql()
{
try {
$this->export->createDatabase('db');
$this->fail();
@ -39,7 +41,8 @@ class Doctrine_Export_Sqlite_TestCase extends Doctrine_UnitTestCase {
$this->pass();
}
}
public function testDropDatabaseDoesNotExecuteSql() {
public function testDropDatabaseDoesNotExecuteSql()
{
try {
$this->export->dropDatabase('db');
$this->fail();
@ -47,16 +50,18 @@ class Doctrine_Export_Sqlite_TestCase extends Doctrine_UnitTestCase {
$this->pass();
}
}
public function testCreateTableSupportsAutoincPks() {
public function testCreateTableSupportsAutoincPks()
{
$name = 'mytable';
$fields = array('id' => array('type' => 'integer', 'unsigned' => 1, 'autoincrement' => true));
$this->export->createTable($name, $fields);
$this->assertEqual($this->adapter->pop(), 'CREATE TABLE mytable (id INTEGER UNSIGNED PRIMARY KEY AUTOINCREMENT)');
$this->assertEqual($this->adapter->pop(), 'CREATE TABLE mytable (id INTEGER PRIMARY KEY AUTOINCREMENT)');
}
public function testCreateTableSupportsDefaultAttribute() {
public function testCreateTableSupportsDefaultAttribute()
{
$name = 'mytable';
$fields = array('name' => array('type' => 'char', 'length' => 10, 'default' => 'def'),
'type' => array('type' => 'integer', 'length' => 3, 'default' => 12)
@ -67,7 +72,8 @@ class Doctrine_Export_Sqlite_TestCase extends Doctrine_UnitTestCase {
$this->assertEqual($this->adapter->pop(), 'CREATE TABLE mytable (name CHAR(10) DEFAULT \'def\', type INTEGER DEFAULT 12, PRIMARY KEY(name, type))');
}
public function testCreateTableSupportsMultiplePks() {
public function testCreateTableSupportsMultiplePks()
{
$name = 'mytable';
$fields = array('name' => array('type' => 'char', 'length' => 10),
'type' => array('type' => 'integer', 'length' => 3));
@ -89,7 +95,7 @@ class Doctrine_Export_Sqlite_TestCase extends Doctrine_UnitTestCase {
$this->export->createTable('sometable', $fields, $options);
$this->assertEqual($this->adapter->pop(), 'CREATE TABLE sometable (id INTEGER UNSIGNED PRIMARY KEY AUTOINCREMENT, name VARCHAR(4), INDEX myindex (id, name))');
$this->assertEqual($this->adapter->pop(), 'CREATE TABLE sometable (id INTEGER PRIMARY KEY AUTOINCREMENT, name VARCHAR(4), INDEX myindex (id, name))');
}
public function testUnknownIndexSortingAttributeThrowsException()
{
@ -120,7 +126,7 @@ class Doctrine_Export_Sqlite_TestCase extends Doctrine_UnitTestCase {
$this->export->createTable('sometable', $fields, $options);
$this->assertEqual($this->adapter->pop(), 'CREATE TABLE sometable (id INTEGER UNSIGNED PRIMARY KEY AUTOINCREMENT, name VARCHAR(4), INDEX myindex (id ASC, name DESC))');
$this->assertEqual($this->adapter->pop(), 'CREATE TABLE sometable (id INTEGER PRIMARY KEY AUTOINCREMENT, name VARCHAR(4), INDEX myindex (id ASC, name DESC))');
}
public function testExportSupportsEmulationOfCascadingDeletes()
{