forked from doctrine/doctrine1
-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add(migrations) Add MySQL migration tests for #98
- Loading branch information
Showing
5 changed files
with
67 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
|
||
class Doctrine_MigrationMysql_TestCase extends Doctrine_UnitTestCase | ||
{ | ||
public function setUp() | ||
{ | ||
parent::setUp(); | ||
$dsn = getenv('MYSQL_TEST_DSN') ?? ''; | ||
|
||
$this->connection = $this->openAdditionalPdoConnection($dsn); | ||
$this->connection->setOption('dsn', $dsn); | ||
$this->connection->dropDatabase(); | ||
$this->connection->createDatabase(); | ||
} | ||
|
||
public function disabled_testAfterSuccessfullMigrationItWillSetMigratedVersionAsCurrentVersionInMysqlDB() | ||
{ | ||
$migration = new Doctrine_Migration(__DIR__.'/migration_classes', $this->connection); | ||
$this->assertFalse($migration->hasMigrated()); | ||
$migration->setCurrentVersion(0); | ||
$this->assertFalse($this->connection->import->tableExists('migration_phonenumber')); | ||
$this->assertFalse($this->connection->import->tableExists('migration_user')); | ||
$this->assertFalse($this->connection->import->tableExists('migration_profile')); | ||
|
||
$migration->migrate(3); | ||
$this->assertTrue($migration->hasMigrated()); | ||
$this->assertEqual($migration->getCurrentVersion(), 3); | ||
$this->assertTrue($this->connection->import->tableExists('migration_phonenumber')); | ||
$this->assertTrue($this->connection->import->tableExists('migration_user')); | ||
$this->assertTrue($this->connection->import->tableExists('migration_profile')); | ||
|
||
$migration->migrate(4); | ||
$this->assertEqual($migration->getCurrentVersion(), 4); | ||
$this->assertTrue($this->connection->import->tableExists('migration_phonenumber')); | ||
$this->assertTrue($this->connection->import->tableExists('migration_user')); | ||
$this->assertFalse($this->connection->import->tableExists('migration_profile')); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters