protected function execute(InputInterface $input, OutputInterface $output) { $configPath = $this->getConfigPath($input->getOption('config')); $config = $this->readConfigFile($configPath); $config = $this->fixOutputFormat($config); $this->config = $this->amendAndValidateConfig($config); $schema = Schema::make($this->config); $createStatements = $schema->getCreateStatements(); file_put_contents($this->config['output_file'], $createStatements); }
/** * @covers ::getCreateStatements */ public function test_getCreateStatements_phpFile() { // Given $this->dbDropAllTables('SCHEMA1'); $this->dbDropAllViews('SCHEMA1'); $this->dbLoadFixtures('SCHEMA1', ['test1.sql', 'view.sql']); // When $dbConfig = $this->getSchemaConfig('SCHEMA1'); $dbConfig['add_if_not_exists'] = true; $gotStmt = Schema::make($dbConfig)->getCreateStatements(Schema::FORMAT_PHP_FILE); // Then $this->assertSame($this->getFixtureData('test1_and_view.txt'), $gotStmt); }