From 5f1d08d7bc438e476a1caa3cc2432a6f0054228e Mon Sep 17 00:00:00 2001
From: Alex Pott <alex.a.pott@googlemail.com>
Date: Tue, 7 Oct 2014 14:23:28 +0200
Subject: [PATCH] Issue #2347111 by znerol: StackKernelIntegrationTest is not
 testing a successful request.

---
 .../HttpKernel/StackKernelIntegrationTest.php |  7 +++---
 .../httpkernel_test.routing.yml               |  6 +++++
 .../src/Controller/TestController.php         | 24 +++++++++++++++++++
 3 files changed, 34 insertions(+), 3 deletions(-)
 create mode 100644 core/modules/system/tests/modules/httpkernel_test/httpkernel_test.routing.yml
 create mode 100644 core/modules/system/tests/modules/httpkernel_test/src/Controller/TestController.php

diff --git a/core/modules/system/src/Tests/HttpKernel/StackKernelIntegrationTest.php b/core/modules/system/src/Tests/HttpKernel/StackKernelIntegrationTest.php
index 103f71fa28d1..6018122c0b3b 100644
--- a/core/modules/system/src/Tests/HttpKernel/StackKernelIntegrationTest.php
+++ b/core/modules/system/src/Tests/HttpKernel/StackKernelIntegrationTest.php
@@ -8,7 +8,9 @@
 namespace Drupal\system\Tests\HttpKernel;
 
 use Drupal\simpletest\KernelTestBase;
+use Drupal\Core\Url;
 use Symfony\Component\HttpFoundation\Request;
+use Symfony\Component\HttpKernel\HttpKernelInterface;
 
 /**
  * Tests the stacked kernel functionality.
@@ -38,14 +40,13 @@ protected function setUp() {
    * Tests a request.
    */
   public function testRequest() {
-    $request = new Request();
+    $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);
+    $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');
   }
 
 }
-
diff --git a/core/modules/system/tests/modules/httpkernel_test/httpkernel_test.routing.yml b/core/modules/system/tests/modules/httpkernel_test/httpkernel_test.routing.yml
new file mode 100644
index 000000000000..7de4338c755c
--- /dev/null
+++ b/core/modules/system/tests/modules/httpkernel_test/httpkernel_test.routing.yml
@@ -0,0 +1,6 @@
+httpkernel_test.empty:
+  path: '/httpkernel-test'
+  defaults:
+    _controller: '\Drupal\httpkernel_test\Controller\TestController::get'
+  requirements:
+    _access: 'TRUE'
diff --git a/core/modules/system/tests/modules/httpkernel_test/src/Controller/TestController.php b/core/modules/system/tests/modules/httpkernel_test/src/Controller/TestController.php
new file mode 100644
index 000000000000..06ca4f633aad
--- /dev/null
+++ b/core/modules/system/tests/modules/httpkernel_test/src/Controller/TestController.php
@@ -0,0 +1,24 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\httpkernel_test\Controller\TestController
+ */
+
+namespace Drupal\httpkernel_test\Controller;
+
+use Symfony\Component\HttpFoundation\Response;
+
+/**
+ * A test controller.
+ */
+class TestController {
+
+  /**
+   * Return an empty response.
+   */
+  public function get() {
+    return new Response();
+  }
+
+}
-- 
GitLab