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]); }
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]); }
public function testStatusAfterOneExecutedMigration() { $input = new Input(); $input->setOption('first', true); $output = new Output(); $command = new MigrateCommand(); $command->setConfig($this->configuration); $command->run($input, $output); $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][8]); $this->assertEquals('|<info> Class name </info>|' . "\n", $messages[0][10]); $this->assertArrayNotHasKey(OutputInterface::VERBOSITY_DEBUG, $messages); }