예제 #1
0
 public function testDryRun()
 {
     $command = new MigrateCommand();
     $command->setConfig($this->configuration);
     $command->run($this->input, $this->output);
     $input = new Input();
     $output = new Output();
     $command = new RollbackCommand();
     $command->setConfig($this->configuration);
     $command->run($input, $output);
     $input = new Input();
     $input->setOption('dry', true);
     $output = new Output();
     $command = new RollbackCommand();
     $command->setConfig($this->configuration);
     $command->run($input, $output);
     $dryMessages = $output->getMessages();
     $dryQueries = array_slice($dryMessages[0], 3, -3);
     $this->assertTrue(is_array($dryMessages));
     $this->assertArrayHasKey(0, $dryMessages);
     $this->assertArrayNotHasKey(OutputInterface::VERBOSITY_DEBUG, $dryMessages);
     $input = new Input();
     $output = new Output();
     $command = new RollbackCommand();
     $command->setConfig($this->configuration);
     $command->run($input, $output);
     $messages = $output->getMessages();
     $this->assertArrayHasKey(OutputInterface::VERBOSITY_DEBUG, $messages);
     $this->assertEquals($dryQueries, $messages[OutputInterface::VERBOSITY_DEBUG]);
 }
예제 #2
0
 public function testDryRun()
 {
     $input = new Input();
     $output = new Output();
     $command = new MigrateCommand();
     $command->setConfig($this->configuration);
     $input->setOption('dry', true);
     $input->setOption('first', true);
     $command->run($input, $output);
     $messages = $output->getMessages();
     $dryMigrationExecuting = $messages[0][6];
     $dryMigrationExecuted = $messages[0][7];
     $dryQueries = array_slice($messages[0], 8, -3);
     $input = new Input();
     $output = new Output();
     $input->setOption('first', true);
     $command->run($input, $output);
     $realRunMessages = $output->getMessages();
     $this->assertEquals($dryQueries, $realRunMessages[OutputInterface::VERBOSITY_DEBUG]);
 }
예제 #3
0
 public function testStatusAfterAllMigrationsExecuted()
 {
     $input = new Input();
     $output = new Output();
     $command = new InitCommand();
     $command->setConfig($this->configuration);
     $command->run($input, $output);
     $input = new Input();
     $output = new Output();
     $command = new MigrateCommand();
     $command->setConfig($this->configuration);
     $command->run($input, $output);
     $executedMigrationsCount = (count($output->getMessages(0)) - 3) / 3;
     $command = new StatusCommand();
     $command->setConfig($this->configuration);
     $command->run($this->input, $this->output);
     $messages = $this->output->getMessages();
     $this->assertTrue(is_array($messages));
     $this->assertArrayHasKey(0, $messages);
     $this->assertEquals('<comment>Executed migrations</comment>' . "\n", $messages[0][1]);
     $this->assertEquals('|<info> Class name </info>|<info> Executed at </info>|' . "\n", $messages[0][3]);
     $this->assertEquals('<comment>Migrations to execute</comment>' . "\n", $messages[0][7 + $executedMigrationsCount]);
     $this->assertEquals('<info>No migrations to execute</info>' . "\n", $messages[0][8 + $executedMigrationsCount]);
     $this->assertArrayNotHasKey(OutputInterface::VERBOSITY_DEBUG, $messages);
 }