예제 #1
0
 public function commitAction()
 {
     $module = $this->request->getParam('module');
     if ($module) {
         $this->console->writeLine('Only for module "' . $module . '":');
     }
     $migration = $this->request->getParam('to');
     $includeModules = $this->request->getParam('includemodules');
     try {
         $this->manager->commit($module, $migration, $includeModules);
         $this->console->writeLine('Migration "' . $migration . '" committed', Color::GREEN);
     } catch (ZFCToolException $e) {
         $this->console->writeLine($e->getMessage(), Color::RED);
     } catch (\Exception $e) {
         $this->console->writeLine($e->getMessage(), Color::RED);
     }
 }
예제 #2
0
 public function testFakeMigration()
 {
     $manager = self::$manager;
     $migrations = self::$manager->listMigrations();
     $this->assertTrue(is_array($migrations));
     $this->assertCount(5, $migrations);
     $this->assertArrayHasKey('name', $migrations[0]);
     $this->assertArrayHasKey('type', $migrations[0]);
     $this->assertEquals($manager::MIGRATION_TYPE_READY, $migrations[0]['type']);
     $this->assertEquals('99999999_000000_00', $migrations[0]['name']);
     self::$manager->commit(null, '99999999_000000_00');
     $migrations = self::$manager->listMigrations();
     $this->assertTrue(is_array($migrations));
     $this->assertCount(5, $migrations);
     $this->assertArrayHasKey('name', $migrations[0]);
     $this->assertArrayHasKey('type', $migrations[0]);
     $this->assertEquals($manager::MIGRATION_TYPE_LOADED, $migrations[0]['type']);
     $this->assertEquals('99999999_000000_00', $migrations[0]['name']);
 }