function ModuleInstallerTest::testKernelRebuildDuringHookInstall

Same name in other branches
  1. 9 core/tests/Drupal/KernelTests/Core/Extension/ModuleInstallerTest.php \Drupal\KernelTests\Core\Extension\ModuleInstallerTest::testKernelRebuildDuringHookInstall()
  2. 10 core/tests/Drupal/KernelTests/Core/Extension/ModuleInstallerTest.php \Drupal\KernelTests\Core\Extension\ModuleInstallerTest::testKernelRebuildDuringHookInstall()
  3. 11.x core/tests/Drupal/KernelTests/Core/Extension/ModuleInstallerTest.php \Drupal\KernelTests\Core\Extension\ModuleInstallerTest::testKernelRebuildDuringHookInstall()

Ensure that rebuilding the container in hook_install() works.

File

core/tests/Drupal/KernelTests/Core/Extension/ModuleInstallerTest.php, line 83

Class

ModuleInstallerTest
Tests the ModuleInstaller class.

Namespace

Drupal\KernelTests\Core\Extension

Code

public function testKernelRebuildDuringHookInstall() {
    \Drupal::state()->set('module_test_install:rebuild_container', TRUE);
    $module_installer = $this->container
        ->get('module_installer');
    $this->assertTrue($module_installer->install([
        'module_test',
    ]));
}

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