You are here

public function StackKernelIntegrationTest::testRequest in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/system/src/Tests/HttpKernel/StackKernelIntegrationTest.php \Drupal\system\Tests\HttpKernel\StackKernelIntegrationTest::testRequest()

Tests a request.

File

core/modules/system/src/Tests/HttpKernel/StackKernelIntegrationTest.php, line 42
Contains \Drupal\system\Tests\HttpKernel\StackKernelIntegrationTest.

Class

StackKernelIntegrationTest
Tests the stacked kernel functionality.

Namespace

Drupal\system\Tests\HttpKernel

Code

public function testRequest() {
  $request = Request::create((new Url('httpkernel_test.empty'))
    ->toString());

  /** @var \Symfony\Component\HttpKernel\HttpKernelInterface $http_kernel */
  $http_kernel = \Drupal::service('http_kernel');
  $http_kernel
    ->handle($request, HttpKernelInterface::MASTER_REQUEST, FALSE);
  $this
    ->assertEqual($request->attributes
    ->get('_hello'), 'world');
  $this
    ->assertEqual($request->attributes
    ->get('_previous_optional_argument'), 'test_argument');
}