function DbCommandBaseTest::testSpecifyDbUrl

Same name and namespace in other branches
  1. 9 core/modules/system/tests/src/Kernel/Scripts/DbCommandBaseTest.php \Drupal\Tests\system\Kernel\Scripts\DbCommandBaseTest::testSpecifyDbUrl()
  2. 8.9.x core/modules/system/tests/src/Kernel/Scripts/DbCommandBaseTest.php \Drupal\Tests\system\Kernel\Scripts\DbCommandBaseTest::testSpecifyDbUrl()
  3. 11.x core/modules/system/tests/src/Kernel/Scripts/DbCommandBaseTest.php \Drupal\Tests\system\Kernel\Scripts\DbCommandBaseTest::testSpecifyDbUrl()

Tests supplying database connection as a URL.

File

core/modules/system/tests/src/Kernel/Scripts/DbCommandBaseTest.php, line 57

Class

DbCommandBaseTest
Test that the DbToolsApplication works correctly.

Namespace

Drupal\Tests\system\Kernel\Scripts

Code

public function testSpecifyDbUrl() : void {
  $command = new DbCommandBaseTester();
  $command_tester = new CommandTester($command);
  $command_tester->execute([
    '-db-url' => Database::getConnectionInfoAsUrl(),
  ]);
  $this->assertEquals('db-tools', $command->getDatabaseConnection($command_tester->getInput())
    ->getKey());
  Database::removeConnection('db-tools');
  $command_tester->execute([
    '--database-url' => Database::getConnectionInfoAsUrl(),
  ]);
  $this->assertEquals('db-tools', $command->getDatabaseConnection($command_tester->getInput())
    ->getKey());
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.