function ToolbarCacheContextsTest::installExtraModules

Same name in other branches
  1. 8.9.x core/modules/toolbar/tests/src/Functional/ToolbarCacheContextsTest.php \Drupal\Tests\toolbar\Functional\ToolbarCacheContextsTest::installExtraModules()
  2. 10 core/modules/toolbar/tests/src/Functional/ToolbarCacheContextsTest.php \Drupal\Tests\toolbar\Functional\ToolbarCacheContextsTest::installExtraModules()
  3. 11.x core/modules/toolbar/tests/src/Functional/ToolbarCacheContextsTest.php \Drupal\Tests\toolbar\Functional\ToolbarCacheContextsTest::installExtraModules()

Installs a given list of modules and rebuilds the cache.

Parameters

string[] $module_list: An array of module names.

2 calls to ToolbarCacheContextsTest::installExtraModules()
ToolbarCacheContextsTest::testCacheIntegration in core/modules/toolbar/tests/src/Functional/ToolbarCacheContextsTest.php
Tests toolbar cache integration.
ToolbarCacheContextsTest::testToolbarCacheContextsCaller in core/modules/toolbar/tests/src/Functional/ToolbarCacheContextsTest.php
Tests toolbar cache contexts.

File

core/modules/toolbar/tests/src/Functional/ToolbarCacheContextsTest.php, line 145

Class

ToolbarCacheContextsTest
Tests the cache contexts for toolbar.

Namespace

Drupal\Tests\toolbar\Functional

Code

protected function installExtraModules(array $module_list) {
    \Drupal::service('module_installer')->install($module_list);
    // Installing modules updates the container and needs a router rebuild.
    $this->container = \Drupal::getContainer();
    $this->container
        ->get('router.builder')
        ->rebuildIfNeeded();
}

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