You are here

protected function RouteNormalizerRequestSubscriberTest::getGetResponseEventStub in Redirect 8

Returns a GET response event object.

Parameters

string $path_info: The path of the request.

array $query_string: The query string of the request.

int $request_type: The request type of the request.

bool $set_request_attribute: If true, the request attribute '_disable_route_normalizer' will be set.

Return value

\Symfony\Component\HttpKernel\Event\GetResponseEvent

4 calls to RouteNormalizerRequestSubscriberTest::getGetResponseEventStub()
RouteNormalizerRequestSubscriberTest::testOnKernelRequestRedirect in tests/src/Unit/RouteNormalizerRequestSubscriberTest.php
@covers ::onKernelRequestRedirect @dataProvider getTestUrls
RouteNormalizerRequestSubscriberTest::testSkipIfFlagNotEnabled in tests/src/Unit/RouteNormalizerRequestSubscriberTest.php
@covers ::onKernelRequestRedirect
RouteNormalizerRequestSubscriberTest::testSkipIfRequestAttribute in tests/src/Unit/RouteNormalizerRequestSubscriberTest.php
@covers ::onKernelRequestRedirect
RouteNormalizerRequestSubscriberTest::testSkipIfSubRequest in tests/src/Unit/RouteNormalizerRequestSubscriberTest.php
@covers ::onKernelRequestRedirect

File

tests/src/Unit/RouteNormalizerRequestSubscriberTest.php, line 213

Class

RouteNormalizerRequestSubscriberTest
Tests the route normalizer.

Namespace

Drupal\Tests\redirect\Unit

Code

protected function getGetResponseEventStub($path_info, $query_string, $request_type = HttpKernelInterface::MASTER_REQUEST, $set_request_attribute = FALSE) {
  $request = Request::create($path_info . '?' . $query_string, 'GET', [], [], [], [
    'SCRIPT_NAME' => 'index.php',
    'SCRIPT_FILENAME' => 'index.php',
  ]);
  if ($set_request_attribute === TRUE) {
    $request->attributes
      ->add([
      '_disable_route_normalizer' => TRUE,
    ]);
  }
  $http_kernel = $this
    ->getMockBuilder('\\Symfony\\Component\\HttpKernel\\HttpKernelInterface')
    ->getMock();
  return new GetResponseEvent($http_kernel, $request, $request_type);
}