Пример #1
0
 public function testListTypeConflictMigrations()
 {
     $manager = self::$manager;
     $migration = '99999999_000000_00';
     self::$manager->up(null, '99999999_000000_01');
     $migrationTable = self::$manager->getMigrationsSchemaTable();
     self::$db->query('DELETE FROM `' . $migrationTable . '` WHERE `migration` = "' . $migration . '";', Adapter::QUERY_MODE_EXECUTE);
     //Test migration not exist in DB, but exist from file system and have old name
     $migrations = self::$manager->listMigrations();
     $this->assertTrue(is_array($migrations));
     $this->assertEquals($manager::MIGRATION_TYPE_CONFLICT, $migrations[0]['type']);
 }
Пример #2
0
 public function testCommitMigration()
 {
     $migration = '99999999_100000_00';
     // dispatch url
     $this->dispatch('ci migration ' . $migration . ' --module=' . self::FIXTURE_MODULE);
     $this->assertActionName('commit');
     $this->assertControllerName('ZFCTool\\Controller\\Migration');
     $this->assertControllerClass('MigrationController');
     $this->assertMatchedRouteName('commit-migration');
     $response = ob_get_contents();
     preg_match("/\\d\\d\\d\\d\\d\\d\\d\\d_\\d\\d\\d\\d\\d\\d_\\d\\d/i", $response, $matches);
     $this->assertNotEmpty($matches);
     $this->assertEquals($migration, $matches[0]);
     $lastMigration = self::$manager->getLastMigration(self::FIXTURE_MODULE);
     $this->assertArrayHasKey('migration', $lastMigration);
     $this->assertNotEquals(0, $lastMigration['migration']);
     $this->assertEquals($lastMigration['migration'], $migration);
     self::$db->query("DROP TABLE `" . self::$manager->getMigrationsSchemaTable() . "`", Adapter::QUERY_MODE_EXECUTE);
 }