Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. FunctionalTestSetupTrait.php

function FunctionalTestSetupTrait::initKernel

Initializes the kernel after installation.

Parameters

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

Return value

\Symfony\Component\DependencyInjection\ContainerInterface The container.

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

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal