public function testDefaults() { $config = new Config(['migration_dirs' => ['first_dir', 'second_dir'], 'environments' => ['first' => [], 'second' => [], 'third' => []]]); $this->assertEquals('phoenix_log', $config->getLogTableName()); $this->assertCount(2, $config->getMigrationDirs()); $this->assertEquals('first', $config->getDefaultEnvironment()); $this->assertInstanceOf('\\Phoenix\\Config\\EnvironmentConfig', $config->getEnvironmentConfig('first')); $this->assertInstanceOf('\\Phoenix\\Config\\EnvironmentConfig', $config->getEnvironmentConfig('second')); $this->assertTrue(is_array($config->getConfiguration())); $this->assertArrayHasKey('migration_dirs', $config->getConfiguration()); $this->assertCount(2, $config->getConfiguration()['migration_dirs']); $this->assertCount(3, $config->getConfiguration()['environments']); }
private function check(InputInterface $input, OutputInterface $output) { try { $executedMigrations = $this->manager->executedMigrations(); } catch (DatabaseQueryExecuteException $e) { $executedMigrations = false; if (!$this instanceof InitCommand) { $init = new InitCommand(); $init->setConfig($this->config->getConfiguration()); $init->execute($input, $output); } } if ($executedMigrations !== false && $this instanceof InitCommand) { throw new WrongCommandException('Phoenix was already initialized, run migrate or rollback command now.'); } }