You are here

protected function ToolbarCacheContextsTest::installExtraModules in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/toolbar/tests/src/Functional/ToolbarCacheContextsTest.php \Drupal\Tests\toolbar\Functional\ToolbarCacheContextsTest::installExtraModules()
  2. 9 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.

File

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

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();
}