public function DbCommandBaseTest::testSpecifyDatabaseKey in Drupal 10
Same name and namespace in other branches
- 8 core/modules/system/tests/src/Kernel/Scripts/DbCommandBaseTest.php \Drupal\Tests\system\Kernel\Scripts\DbCommandBaseTest::testSpecifyDatabaseKey()
- 9 core/modules/system/tests/src/Kernel/Scripts/DbCommandBaseTest.php \Drupal\Tests\system\Kernel\Scripts\DbCommandBaseTest::testSpecifyDatabaseKey()
Tests specifying a database key.
File
- core/
modules/ system/ tests/ src/ Kernel/ Scripts/ DbCommandBaseTest.php, line 31 - Contains \Drupal\Tests\system\Kernel\Scripts\DbCommandBaseTest.
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');
}