You are here

protected function FunctionalTestSetupTrait::initKernel in Drupal 9

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Test/FunctionalTestSetupTrait.php \Drupal\Core\Test\FunctionalTestSetupTrait::initKernel()
  2. 10 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.

3 calls to FunctionalTestSetupTrait::initKernel()
BrowserTestBase::installDrupal in core/tests/Drupal/Tests/BrowserTestBase.php
Installs Drupal into the Simpletest site.
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
Installs Drupal into the Simpletest site.

File

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

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