function DrupalKernelTest::testRepeatedBootWithDifferentEnvironment

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

Tests repeated loading of compiled DIC with different environment.

File

core/tests/Drupal/KernelTests/Core/DrupalKernel/DrupalKernelTest.php, line 147

Class

DrupalKernelTest
Tests DIC compilation to disk.

Namespace

Drupal\KernelTests\Core\DrupalKernel

Code

public function testRepeatedBootWithDifferentEnvironment() {
    $request = Request::createFromGlobals();
    $class_loader = (require $this->root . '/autoload.php');
    $environments = [
        'testing1',
        'testing1',
        'testing2',
        'testing2',
    ];
    foreach ($environments as $environment) {
        $kernel = DrupalKernel::createFromRequest($request, $class_loader, $environment);
        $this->setSetting('container_yamls', []);
        $this->setSetting('hash_salt', $this->databasePrefix);
        $this->assertInstanceOf(DrupalKernelInterface::class, $kernel->boot(), "Environment {$environment} should boot.");
    }
}

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