You are here

public function DbCommandBaseTest::testSpecifyDatabaseDoesNotExist in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/system/tests/src/Kernel/Scripts/DbCommandBaseTest.php \Drupal\Tests\system\Kernel\Scripts\DbCommandBaseTest::testSpecifyDatabaseDoesNotExist()
  2. 9 core/modules/system/tests/src/Kernel/Scripts/DbCommandBaseTest.php \Drupal\Tests\system\Kernel\Scripts\DbCommandBaseTest::testSpecifyDatabaseDoesNotExist()

Invalid database names will throw a useful exception.

File

core/modules/system/tests/src/Kernel/Scripts/DbCommandBaseTest.php, line 47
Contains \Drupal\Tests\system\Kernel\Scripts\DbCommandBaseTest.

Class

DbCommandBaseTest
Test that the DbToolsApplication works correctly.

Namespace

Drupal\Tests\system\Kernel\Scripts

Code

public function testSpecifyDatabaseDoesNotExist() {
  $command = new DbCommandBaseTester();
  $command_tester = new CommandTester($command);
  $command_tester
    ->execute([
    '--database' => 'dne',
  ]);
  $this
    ->expectException(ConnectionNotDefinedException::class);
  $command
    ->getDatabaseConnection($command_tester
    ->getInput());
}