You are here

public function BrowserTestBase::installDrupal in Drupal 10

Same name and namespace in other branches
  1. 8 core/tests/Drupal/Tests/BrowserTestBase.php \Drupal\Tests\BrowserTestBase::installDrupal()
  2. 9 core/tests/Drupal/Tests/BrowserTestBase.php \Drupal\Tests\BrowserTestBase::installDrupal()

Installs Drupal into the test site.

1 call to BrowserTestBase::installDrupal()
BrowserTestBase::setUp in core/tests/Drupal/Tests/BrowserTestBase.php
1 method overrides BrowserTestBase::installDrupal()
UpdatePathTestBase::installDrupal in core/tests/Drupal/FunctionalTests/Update/UpdatePathTestBase.php
Installs Drupal into the test site.

File

core/tests/Drupal/Tests/BrowserTestBase.php, line 549

Class

BrowserTestBase
Provides a test case for functional Drupal tests.

Namespace

Drupal\Tests

Code

public function installDrupal() {
  $this
    ->initUserSession();
  $this
    ->prepareSettings();
  $this
    ->doInstall();
  $this
    ->initSettings();
  $this->container = $container = $this
    ->initKernel(\Drupal::request());
  $this
    ->initConfig($container);
  $this
    ->installDefaultThemeFromClassProperty($container);
  $this
    ->installModulesFromClassProperty($container);

  // Clear the static cache so that subsequent cache invalidations will work
  // as expected.
  $this->container
    ->get('cache_tags.invalidator')
    ->resetChecksums();

  // Generate a route to prime the url generator with the correct base url.
  // @todo Remove in https://www.drupal.org/project/drupal/issues/3207896.
  Url::fromRoute('<front>')
    ->setAbsolute()
    ->toString();

  // Explicitly call register() again on the container registered in \Drupal.
  // @todo This should already be called through
  //   DrupalKernel::prepareLegacyRequest() -> DrupalKernel::boot() but that
  //   appears to be calling a different container.
  $this->container
    ->get('stream_wrapper_manager')
    ->register();
}