Beispiel #1
0
 /**
  * @covers ::checkDbPassword
  * @covers ::askDbPassword
  */
 public function test_checkDbPassword_missing()
 {
     // Given
     $cfg = self::getFixtureData('db_config.json');
     $cfg[Schema::CONFIG_KEY_CONNECTION][DbConnector::DB_CFG_PASSWORD] = '';
     // When
     $config = $this->cmd->checkDbPassword($cfg);
     // Then
     $this->expectOutputString('Enter database password: '******'testPassABC', $config[Schema::CONFIG_KEY_CONNECTION][DbConnector::DB_CFG_PASSWORD]);
 }
Beispiel #2
0
 /**
  * @covers ::execute
  */
 public function test_execute_sql()
 {
     // Given
     $this->dbDropAllTables('SCHEMA1');
     $this->dbLoadFixtures('SCHEMA1', 'bigtable_create.sql');
     $vCfg = vfsStream::newDirectory('cfg')->at($this->vfsRoot);
     $vTmp = vfsStream::newDirectory('tmp')->at($vCfg);
     $vSchema = vfsStream::newFile('schema.sql')->at($vTmp);
     $cfgFile = vfsStream::newFile('db_config.json')->withContent(self::getFixtureRawData('db_config_sql.json'))->at($vCfg)->url();
     $cmd = new CommandTester($this->cmd);
     // When
     $cmd->execute(['command' => $this->cmd->getName(), '--config' => $cfgFile]);
     $expFile = $this->getFixtureRawData('bigtable-schema-dump.sql');
     $gotFile = file_get_contents($vSchema->url());
     // Then
     $this->assertSame($expFile, $gotFile);
 }