示例#1
0
 public function testBreakpointsOperateAsExpected()
 {
     if (!TESTS_PHINX_DB_ADAPTER_MYSQL_ENABLED) {
         $this->markTestSkipped('Mysql tests disabled. See TESTS_PHINX_DB_ADAPTER_MYSQL_ENABLED constant.');
     }
     $configArray = $this->getConfigArray();
     $adapter = $this->manager->getEnvironment('production')->getAdapter();
     $config = new Config($configArray);
     // ensure the database is empty
     $adapter->dropDatabase(TESTS_PHINX_DB_ADAPTER_MYSQL_DATABASE);
     $adapter->createDatabase(TESTS_PHINX_DB_ADAPTER_MYSQL_DATABASE);
     $adapter->disconnect();
     // migrate to the latest version
     $this->manager->setConfig($config);
     $this->manager->migrate('production');
     // set breakpoint on most recent migration
     $this->manager->toggleBreakpoint('production', null);
     // ensure breakpoint is set
     $versions = $this->manager->getEnvironment('production')->getVersionLog();
     $this->assertEquals(1, end($versions)['breakpoint']);
     // reset all breakpoints
     $this->manager->removeBreakpoints('production');
     // ensure breakpoint is not set
     $versions = $this->manager->getEnvironment('production')->getVersionLog();
     $this->assertEquals(0, end($versions)['breakpoint']);
 }