function TestSiteApplicationTest::addTestDatabase

Adds the installed test site to the database connection info.

Parameters

string $db_prefix: The prefix of the installed test site.

Return value

string The database key of the added connection.

1 call to TestSiteApplicationTest::addTestDatabase()
TestSiteApplicationTest::testInstallScript in core/tests/Drupal/KernelTests/Scripts/TestSiteApplicationTest.php
@coversNothing[[api-linebreak]]

File

core/tests/Drupal/KernelTests/Scripts/TestSiteApplicationTest.php, line 288

Class

TestSiteApplicationTest
Tests core/scripts/test-site.php.

Namespace

Drupal\KernelTests\Scripts

Code

protected function addTestDatabase($db_prefix) : string {
  $database = Database::convertDbUrlToConnectionInfo(getenv('SIMPLETEST_DB'));
  $database['prefix'] = $db_prefix;
  $target = __CLASS__ . $db_prefix;
  Database::addConnectionInfo($target, 'default', $database);
  return $target;
}

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