Пример #1
0
 /**
  * @param array $expected
  * @param int   $version
  * @param array $upgrades
  * @param array $downgrades
  * @dataProvider versionRanges
  */
 public function testGetVersionRange(array $expected, $version, array $upgrades, array $downgrades)
 {
     $this->log->method('getCurrentVersion')->willReturn($version);
     $this->reader->method('upgradeExistsTo')->willReturnCallback(function ($v) use($upgrades) {
         return in_array($v, $upgrades);
     });
     $this->reader->method('downgradeExistsFrom')->willReturnCallback(function ($v) use($downgrades) {
         return in_array($v, $downgrades);
     });
     $this->assertEquals($expected, $this->migratorReal->getVersionRange());
 }
Пример #2
0
 /**
  * @dataProvider versionsAndRanges
  * @param array $data_set
  * @throws Exception
  */
 public function testMigrationAndRange(array $data_set)
 {
     foreach ($data_set as $parameters) {
         list($version, $range, $expectedTables) = $parameters;
         $this->migrator->migrateTo($version);
         $this->assertEquals($range, $this->migrator->getVersionRange());
         $tables = $this->getTables();
         unset($tables['__version_log']);
         $this->assertEquals($expectedTables, $tables);
     }
 }
Пример #3
0
 /**
  * Execute the console command.
  *
  * @return void
  */
 public function fire()
 {
     if (!$this->confirmToProceed()) {
         return;
     }
     $this->migrator->setConnection($this->input->getOption('database'));
     $pretend = $this->input->getOption('pretend');
     $this->migrator->rollback($pretend);
     // Once the migrator has run we will grab the note output and send it out to
     // the console screen, since the migrator itself functions without having
     // any instances of the OutputInterface contract passed into the class.
     foreach ($this->migrator->getNotes() as $note) {
         $this->output->writeln($note);
     }
 }