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