Exemplo n.º 1
0
 public function onDispatch(MvcEvent $e)
 {
     if (!$e->getRequest() instanceof ConsoleRequest) {
         throw new RuntimeException('You can only use this action from a console!');
     }
     $version = $e->getRequest()->getParam('version');
     $force = $e->getRequest()->getParam('force');
     $down = $e->getRequest()->getParam('down');
     if (is_null($version) && $force) {
         $response = "Can't force migration apply without migration version explicitly set.\n";
         $e->setResult($response);
         return $response;
     }
     $this->migration->migrate($version, $force, $down);
     $response = "Migrations applied!\n";
     $e->setResult($response);
     return $response;
 }
Exemplo n.º 2
0
 public function testGetMaxMigrationVersion()
 {
     $versions = [['version' => 33], ['version' => 77]];
     $result = $this->migration->getMaxMigrationVersion(new \ArrayIterator($versions));
     $this->assertEquals(77, $result);
 }