function FunctionalTestSetupTrait::initKernel

Same name in other branches
  1. 9 core/lib/Drupal/Core/Test/FunctionalTestSetupTrait.php \Drupal\Core\Test\FunctionalTestSetupTrait::initKernel()
  2. 8.9.x core/lib/Drupal/Core/Test/FunctionalTestSetupTrait.php \Drupal\Core\Test\FunctionalTestSetupTrait::initKernel()
  3. 11.x core/lib/Drupal/Core/Test/FunctionalTestSetupTrait.php \Drupal\Core\Test\FunctionalTestSetupTrait::initKernel()

Initializes the kernel after installation.

Parameters

\Symfony\Component\HttpFoundation\Request $request: Request object.

Return value

\Symfony\Component\DependencyInjection\ContainerInterface The container.

5 calls to FunctionalTestSetupTrait::initKernel()
BrowserTestBase::installDrupal in core/tests/Drupal/Tests/BrowserTestBase.php
Installs Drupal into the test site.
DevelopmentSettingsFormTest::testDisabledRenderedOutputCacheBins in core/modules/system/tests/src/FunctionalJavascript/Form/DevelopmentSettingsFormTest.php
Tests disabling cache bins which cache markup.
DevelopmentSettingsFormTest::testTwigDevelopmentMode in core/modules/system/tests/src/FunctionalJavascript/Form/DevelopmentSettingsFormTest.php
Tests turning on Twig development mode.
TestSiteInstallCommand::installDrupal in core/tests/Drupal/TestSite/Commands/TestSiteInstallCommand.php
Installs Drupal into the test site.
UpdatePathTestBase::installDrupal in core/tests/Drupal/FunctionalTests/Update/UpdatePathTestBase.php
Overrides BrowserTestBase::installDrupal() for update testing.

File

core/lib/Drupal/Core/Test/FunctionalTestSetupTrait.php, line 416

Class

FunctionalTestSetupTrait
Defines a trait for shared functional test setup functionality.

Namespace

Drupal\Core\Test

Code

protected function initKernel(Request $request) {
    $this->kernel = DrupalKernel::createFromRequest($request, $this->classLoader, 'prod', TRUE);
    $this->kernel
        ->boot();
    // Add our request to the stack and route context.
    $request->attributes
        ->set(RouteObjectInterface::ROUTE_OBJECT, new Route('<none>'));
    $request->attributes
        ->set(RouteObjectInterface::ROUTE_NAME, '<none>');
    $this->kernel
        ->preHandle($request);
    return $this->kernel
        ->getContainer();
}

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