Commit 5f1d08d7 authored by alexpott's avatar alexpott

Issue #2347111 by znerol: StackKernelIntegrationTest is not testing a successful request.

parent 428ff5b0
......@@ -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');
}
}
httpkernel_test.empty:
path: '/httpkernel-test'
defaults:
_controller: '\Drupal\httpkernel_test\Controller\TestController::get'
requirements:
_access: 'TRUE'
<?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();
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment