public function testMigrationPerform()
 {
     // Simulate a previous run with object in version 1
     ObjectVersion::inc('ObjC');
     $migration = new Migration();
     $migration->addObject('ObjC');
     $migration->show();
     $migration->check();
     $this->setExpectedException('Exception');
     $migration->perform();
 }
 public function _perform($class)
 {
     $version = ObjectVersion::get($class);
     echo 'Object ' . $class . ' is in version ' . $version . PHP_EOL;
     while (true) {
         $migrateFunction = 'migrate_' . $version . '_' . ($version + 1);
         if (method_exists($class, $migrateFunction) === false) {
             break;
         }
         echo 'Migrate from ' . $version . ' to ' . ($version + 1) . PHP_EOL;
         $ok = forward_static_call(array($class, $migrateFunction));
         if ($ok !== true) {
             echo 'Failed' . PHP_EOL;
             break;
         }
         $version = ObjectVersion::inc($class);
         echo 'Ok' . PHP_EOL;
     }
 }