protected function DrupalUnitTestBase::enableModules

Enables modules for this test.

Parameters

array $modules: A list of modules to enable. Dependencies are not resolved; i.e., multiple modules have to be specified with dependent modules first. The new modules are only added to the active module list and loaded.

33 calls to DrupalUnitTestBase::enableModules()
CKEditorPluginManagerTest::setUp in drupal/core/modules/ckeditor/lib/Drupal/ckeditor/Tests/CKEditorPluginManagerTest.php
Sets up Drupal unit test environment.
CKEditorPluginManagerTest::testEnabledPlugins in drupal/core/modules/ckeditor/lib/Drupal/ckeditor/Tests/CKEditorPluginManagerTest.php
Tests the enabling of plugins.
CKEditorTest::setUp in drupal/core/modules/ckeditor/lib/Drupal/ckeditor/Tests/CKEditorTest.php
Sets up Drupal unit test environment.
CKEditorTest::testBuildContentsCssJSSetting in drupal/core/modules/ckeditor/lib/Drupal/ckeditor/Tests/CKEditorTest.php
Tests CKEditor::buildContentsCssJSSetting().
CKEditorTest::testBuildToolbarJSSetting in drupal/core/modules/ckeditor/lib/Drupal/ckeditor/Tests/CKEditorTest.php
Tests CKEditor::buildToolbarJSSetting().

... See full list

File

drupal/core/modules/simpletest/lib/Drupal/simpletest/DrupalUnitTestBase.php, line 257
Contains Drupal\simpletest\DrupalUnitTestBase.

Class

DrupalUnitTestBase
Base test case class for Drupal unit tests.

Namespace

Drupal\simpletest

Code

protected function enableModules(array $modules) {

  // Set the list of modules in the extension handler.
  $module_handler = $this->container
    ->get('module_handler');
  $module_filenames = $module_handler
    ->getModuleList();
  foreach ($modules as $module) {
    $module_filenames[$module] = drupal_get_filename('module', $module);
  }
  $module_handler
    ->setModuleList($module_filenames);
  $module_handler
    ->resetImplementations();

  // Update the kernel to make their services available.
  $this->kernel
    ->updateModules($module_filenames, $module_filenames);

  // Ensure isLoaded() is TRUE in order to make theme() work.
  // Note that the kernel has rebuilt the container; this $module_handler is
  // no longer the $module_handler instance from above.
  $module_handler = $this->container
    ->get('module_handler');
  $module_handler
    ->reload();
  $this
    ->pass(format_string('Enabled modules: %modules.', array(
    '%modules' => implode(', ', $modules),
  )));
}