Changeset 3565 for trunk/tests/Export

Show
Ignore:
Timestamp:
01/22/08 21:42:17 (12 months ago)
Author:
jwage
Message:

Connection refactoring to allow create/drop database functionality for sqlite. fixes #480

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/tests/Export/SqliteTestCase.php

    r3501 r3565  
    3333class Doctrine_Export_Sqlite_TestCase extends Doctrine_UnitTestCase 
    3434{ 
    35     public function testCreateDatabaseDoesNotExecuteSql() 
     35    public function testCreateDatabaseDoesNotExecuteSqlAndCreatesSqliteFile() 
    3636    { 
    37         try { 
    38             $this->export->createDatabase('db'); 
    39             $this->fail(); 
    40         } catch(Doctrine_Export_Exception $e) { 
    41             $this->pass(); 
    42         } 
     37        $this->export->createDatabase('sqlite.db'); 
     38         
     39        $this->assertTrue(file_exists('sqlite.db')); 
    4340    } 
    44     public function testDropDatabaseDoesNotExecuteSql() 
     41    public function testDropDatabaseDoesNotExecuteSqlAndDeletesSqliteFile() 
    4542    { 
    46         try { 
    47             $this->export->dropDatabase('db'); 
    48             $this->fail(); 
    49         } catch(Doctrine_Export_Exception $e) { 
    50             $this->pass(); 
    51         } 
     43        $this->export->dropDatabase('sqlite.db'); 
     44 
     45        $this->assertFalse(file_exists('sqlite.db')); 
    5246    } 
    5347    public function testCreateTableSupportsAutoincPks() 
     
    172166        $this->export->createTable('sometable', $fields, $options); 
    173167 
    174         //removed this assertion and inserted the two below 
    175 //        $this->assertEqual($this->adapter->pop(), 'CREATE TABLE sometable (id INTEGER PRIMARY KEY AUTOINCREMENT, name VARCHAR(4), INDEX myindex (id ASC, name DESC))'); 
    176  
    177168        $this->assertEqual($this->adapter->pop(),"CREATE INDEX myindex_idx ON sometable (id ASC, name DESC)"); 
    178169 
     
    180171 
    181172    } 
    182  
    183     /** 
    184     public function testExportSupportsEmulationOfCascadingDeletes() 
    185     { 
    186         $r = new ForeignKeyTest; 
    187  
    188         $this->assertEqual($this->adapter->pop(), 'COMMIT'); 
    189         $this->assertEqual($this->adapter->pop(), 'CREATE TRIGGER doctrine_foreign_key_test_cscd_delete AFTER DELETE ON foreign_key_test BEGIN DELETE FROM foreign_key_test WHERE parent_id = old.id;END;'); 
    190         $this->assertEqual($this->adapter->pop(), 'CREATE TABLE foreign_key_test (id INTEGER PRIMARY KEY AUTOINCREMENT, name VARCHAR(2147483647), code INTEGER, content VARCHAR(4000), parent_id INTEGER)'); 
    191         $this->assertEqual($this->adapter->pop(), 'BEGIN TRANSACTION'); 
    192     } 
    193     */ 
    194173}