function DbCommandBaseTest::testSpecifyDatabaseKey
Test specifying a database key.
File
- 
              core/
modules/ system/ tests/ src/ Kernel/ Scripts/ DbCommandBaseTest.php, line 31  
Class
- DbCommandBaseTest
 - Test that the DbToolsApplication works correctly.
 
Namespace
Drupal\Tests\system\Kernel\ScriptsCode
public function testSpecifyDatabaseKey() {
  $command = new DbCommandBaseTester();
  $command_tester = new CommandTester($command);
  Database::addConnectionInfo('magic_db', 'default', Database::getConnectionInfo('default')['default']);
  $command_tester->execute([
    '--database' => 'magic_db',
  ]);
  $this->assertEquals('magic_db', $command->getDatabaseConnection($command_tester->getInput())
    ->getKey(), 'Special db key is returned');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.