diff --git a/core/lib/Drupal/Core/DrupalKernel.php b/core/lib/Drupal/Core/DrupalKernel.php index 2eea7f987c6421bcc613b30639722a120527697c..90fa2fce5a00538dd79be1a3bf88d2ac01d74bd0 100644 --- a/core/lib/Drupal/Core/DrupalKernel.php +++ b/core/lib/Drupal/Core/DrupalKernel.php @@ -686,7 +686,7 @@ public function terminate(Request $request, Response $response) { /** * {@inheritdoc} */ - public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = TRUE): Response { + public function handle(Request $request, $type = self::MAIN_REQUEST, $catch = TRUE): Response { // Ensure sane PHP environment variables. static::bootEnvironment(); @@ -726,7 +726,7 @@ public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = * @param \Symfony\Component\HttpFoundation\Request $request * A Request instance * @param int $type - * The type of the request (one of HttpKernelInterface::MASTER_REQUEST or + * The type of the request (one of HttpKernelInterface::MAIN_REQUEST or * HttpKernelInterface::SUB_REQUEST) * * @return \Symfony\Component\HttpFoundation\Response diff --git a/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php b/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php index 5df27acc714289df757db826449b8fcb3ba0e36e..25ff6fc595ed5fc2ab55e21933dd330112b7d7b6 100644 --- a/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php +++ b/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php @@ -42,7 +42,7 @@ public function __construct(HttpKernelInterface $http_kernel, DrupalKernelInterf /** * {@inheritdoc} */ - public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = TRUE): Response { + public function handle(Request $request, $type = self::MAIN_REQUEST, $catch = TRUE): Response { $this->drupalKernel->preHandle($request); return $this->httpKernel->handle($request, $type, $catch); diff --git a/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php b/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php index ecc6dd61ea1c34f7b4ff5393a622e90aca3edf87..37054a6aa0f9c136b426466e4fe3a14cbdc469be 100644 --- a/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php +++ b/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php @@ -38,7 +38,7 @@ public function __construct(HttpKernelInterface $app) { /** * {@inheritdoc} */ - public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = TRUE): Response { + public function handle(Request $request, $type = self::MAIN_REQUEST, $catch = TRUE): Response { // Register available mime types. foreach ($this->formats as $format => $mime_type) { $request->setFormat($format, $mime_type); diff --git a/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php b/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php index 69221e7989192bc54932a505e5f142eb5e2eddf5..9e3c6f77906d6ca5c2b3b375f639a0a7b7ca0d44 100644 --- a/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php +++ b/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php @@ -42,7 +42,7 @@ public function __construct(HttpKernelInterface $http_kernel, Settings $settings /** * {@inheritdoc} */ - public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = TRUE): Response { + public function handle(Request $request, $type = self::MAIN_REQUEST, $catch = TRUE): Response { // Initialize proxy settings. static::setSettingsOnRequest($request, $this->settings); return $this->httpKernel->handle($request, $type, $catch); diff --git a/core/lib/Drupal/Core/StackMiddleware/Session.php b/core/lib/Drupal/Core/StackMiddleware/Session.php index 8c3eb5d74f0fe3f04a10412ca7b7b5c4be539106..d9da60ac602518ae5a71d66f1d7df673307d0363 100644 --- a/core/lib/Drupal/Core/StackMiddleware/Session.php +++ b/core/lib/Drupal/Core/StackMiddleware/Session.php @@ -48,8 +48,8 @@ public function __construct(HttpKernelInterface $http_kernel, $service_name = 's /** * {@inheritdoc} */ - public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = TRUE): Response { - if ($type === self::MASTER_REQUEST && PHP_SAPI !== 'cli') { + public function handle(Request $request, $type = self::MAIN_REQUEST, $catch = TRUE): Response { + if ($type === self::MAIN_REQUEST && PHP_SAPI !== 'cli') { $session = $this->container->get($this->sessionServiceName); $session->start(); $request->setSession($session); @@ -57,7 +57,7 @@ public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = $result = $this->httpKernel->handle($request, $type, $catch); - if ($type === self::MASTER_REQUEST && $request->hasSession()) { + if ($type === self::MAIN_REQUEST && $request->hasSession()) { $request->getSession()->save(); } diff --git a/core/lib/Drupal/Core/Update/UpdateKernel.php b/core/lib/Drupal/Core/Update/UpdateKernel.php index 4a781ff477d2c1da6813d6356202749e2ceda8b8..5a8d8f3d30766ba889e113e8b0d75b0d593ac2af 100644 --- a/core/lib/Drupal/Core/Update/UpdateKernel.php +++ b/core/lib/Drupal/Core/Update/UpdateKernel.php @@ -55,7 +55,7 @@ protected function cacheDrupalContainer(array $container_definition) { /** * {@inheritdoc} */ - public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = TRUE): Response { + public function handle(Request $request, $type = self::MAIN_REQUEST, $catch = TRUE): Response { try { static::bootEnvironment(); diff --git a/core/modules/ban/src/BanMiddleware.php b/core/modules/ban/src/BanMiddleware.php index dc5b8d4dae00432a61f4f4940a52c025bf92f615..87d3d6591bbad9370ba3ed0b12e5a054de6792f8 100644 --- a/core/modules/ban/src/BanMiddleware.php +++ b/core/modules/ban/src/BanMiddleware.php @@ -42,7 +42,7 @@ public function __construct(HttpKernelInterface $http_kernel, BanIpManagerInterf /** * {@inheritdoc} */ - public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = TRUE): Response { + public function handle(Request $request, $type = self::MAIN_REQUEST, $catch = TRUE): Response { $ip = $request->getClientIp(); if ($this->banIpManager->isBanned($ip)) { return new Response(new FormattableMarkup('@ip has been banned', ['@ip' => $ip]), 403); diff --git a/core/modules/ban/tests/src/Unit/BanMiddlewareTest.php b/core/modules/ban/tests/src/Unit/BanMiddlewareTest.php index 4b5a0ee27a9ba4cf4c5714918c2d5717af448dda..7f12b37e5dbf9ba24947c2d003b56d65db25660e 100644 --- a/core/modules/ban/tests/src/Unit/BanMiddlewareTest.php +++ b/core/modules/ban/tests/src/Unit/BanMiddlewareTest.php @@ -81,7 +81,7 @@ public function testUnbannedIp() { $expected_response = new Response(200); $this->kernel->expects($this->once()) ->method('handle') - ->with($request, HttpKernelInterface::MASTER_REQUEST, TRUE) + ->with($request, HttpKernelInterface::MAIN_REQUEST, TRUE) ->willReturn($expected_response); $response = $this->banMiddleware->handle($request); diff --git a/core/modules/big_pipe/src/Render/BigPipe.php b/core/modules/big_pipe/src/Render/BigPipe.php index 133c86534eb55b0e0c566a0f1a8c144c9d906229..98550287633889870e13463a9a0b162786a96560 100644 --- a/core/modules/big_pipe/src/Render/BigPipe.php +++ b/core/modules/big_pipe/src/Render/BigPipe.php @@ -637,7 +637,7 @@ protected function filterEmbeddedResponse(Request $fake_request, Response $embed * The request for which a response is being sent. * @param int $request_type * The request type. Can either be - * \Symfony\Component\HttpKernel\HttpKernelInterface::MASTER_REQUEST or + * \Symfony\Component\HttpKernel\HttpKernelInterface::MAIN_REQUEST or * \Symfony\Component\HttpKernel\HttpKernelInterface::SUB_REQUEST. * @param \Symfony\Component\HttpFoundation\Response $response * The response to filter. @@ -646,7 +646,7 @@ protected function filterEmbeddedResponse(Request $fake_request, Response $embed * The filtered response. */ protected function filterResponse(Request $request, $request_type, Response $response) { - assert($request_type === HttpKernelInterface::MASTER_REQUEST || $request_type === HttpKernelInterface::SUB_REQUEST); + assert($request_type === HttpKernelInterface::MAIN_REQUEST || $request_type === HttpKernelInterface::SUB_REQUEST); $this->requestStack->push($request); $event = new ResponseEvent($this->httpKernel, $request, $request_type, $response); $this->eventDispatcher->dispatch($event, KernelEvents::RESPONSE); diff --git a/core/modules/page_cache/src/StackMiddleware/PageCache.php b/core/modules/page_cache/src/StackMiddleware/PageCache.php index 2c425657fbcf9d49c8c04a5d685a8cc610933abc..05a70187e1ad03d82187afdd8a982b25fa7ff48c 100644 --- a/core/modules/page_cache/src/StackMiddleware/PageCache.php +++ b/core/modules/page_cache/src/StackMiddleware/PageCache.php @@ -76,9 +76,9 @@ public function __construct(HttpKernelInterface $http_kernel, CacheBackendInterf /** * {@inheritdoc} */ - public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = TRUE): Response { + public function handle(Request $request, $type = self::MAIN_REQUEST, $catch = TRUE): Response { // Only allow page caching on master request. - if ($type === static::MASTER_REQUEST && $this->requestPolicy->check($request) === RequestPolicyInterface::ALLOW) { + if ($type === static::MAIN_REQUEST && $this->requestPolicy->check($request) === RequestPolicyInterface::ALLOW) { $response = $this->lookup($request, $type, $catch); } else { @@ -94,7 +94,7 @@ public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = * @param \Symfony\Component\HttpFoundation\Request $request * A request object. * @param int $type - * The type of the request (one of HttpKernelInterface::MASTER_REQUEST or + * The type of the request (one of HttpKernelInterface::MAIN_REQUEST or * HttpKernelInterface::SUB_REQUEST) * @param bool $catch * Whether to catch exceptions or not @@ -102,7 +102,7 @@ public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = * @returns \Symfony\Component\HttpFoundation\Response $response * A response object. */ - protected function pass(Request $request, $type = self::MASTER_REQUEST, $catch = TRUE) { + protected function pass(Request $request, $type = self::MAIN_REQUEST, $catch = TRUE) { return $this->httpKernel->handle($request, $type, $catch); } @@ -112,7 +112,7 @@ protected function pass(Request $request, $type = self::MASTER_REQUEST, $catch = * @param \Symfony\Component\HttpFoundation\Request $request * A request object. * @param int $type - * The type of the request (one of HttpKernelInterface::MASTER_REQUEST or + * The type of the request (one of HttpKernelInterface::MAIN_REQUEST or * HttpKernelInterface::SUB_REQUEST) * @param bool $catch * Whether to catch exceptions or not @@ -120,7 +120,7 @@ protected function pass(Request $request, $type = self::MASTER_REQUEST, $catch = * @returns \Symfony\Component\HttpFoundation\Response $response * A response object. */ - protected function lookup(Request $request, $type = self::MASTER_REQUEST, $catch = TRUE) { + protected function lookup(Request $request, $type = self::MAIN_REQUEST, $catch = TRUE) { if ($response = $this->get($request)) { $response->headers->set('X-Drupal-Cache', 'HIT'); } @@ -178,7 +178,7 @@ protected function lookup(Request $request, $type = self::MASTER_REQUEST, $catch * @param \Symfony\Component\HttpFoundation\Request $request * A request object. * @param int $type - * The type of the request (one of HttpKernelInterface::MASTER_REQUEST or + * The type of the request (one of HttpKernelInterface::MAIN_REQUEST or * HttpKernelInterface::SUB_REQUEST) * @param bool $catch * Whether to catch exceptions or not @@ -186,7 +186,7 @@ protected function lookup(Request $request, $type = self::MASTER_REQUEST, $catch * @returns \Symfony\Component\HttpFoundation\Response $response * A response object. */ - protected function fetch(Request $request, $type = self::MASTER_REQUEST, $catch = TRUE) { + protected function fetch(Request $request, $type = self::MAIN_REQUEST, $catch = TRUE) { /** @var \Symfony\Component\HttpFoundation\Response $response */ $response = $this->httpKernel->handle($request, $type, $catch); diff --git a/core/modules/quickedit/tests/src/Kernel/EditorIntegrationTest.php b/core/modules/quickedit/tests/src/Kernel/EditorIntegrationTest.php index 6852bafdb5ea0a3948bb1e6ff755b8bc8fdc5ee5..4dd1bd037655e6d8796cbbb5f84a04af5b31356a 100644 --- a/core/modules/quickedit/tests/src/Kernel/EditorIntegrationTest.php +++ b/core/modules/quickedit/tests/src/Kernel/EditorIntegrationTest.php @@ -235,7 +235,7 @@ public function testGetUntransformedTextCommand() { $event = new ResponseEvent( \Drupal::service('http_kernel'), $request, - HttpKernelInterface::MASTER_REQUEST, + HttpKernelInterface::MAIN_REQUEST, $response ); $subscriber->onResponse($event); diff --git a/core/modules/rest/tests/src/Unit/EventSubscriber/ResourceResponseSubscriberTest.php b/core/modules/rest/tests/src/Unit/EventSubscriber/ResourceResponseSubscriberTest.php index 8ff2eae36ef7b7bcae9f75df2f81b7bdbf1120ce..44f5d55dc4a4cc007c05c61e824429d069f8155d 100644 --- a/core/modules/rest/tests/src/Unit/EventSubscriber/ResourceResponseSubscriberTest.php +++ b/core/modules/rest/tests/src/Unit/EventSubscriber/ResourceResponseSubscriberTest.php @@ -42,7 +42,7 @@ public function testSerialization($data, $expected_response = FALSE) { $event = new ResponseEvent( $this->prophesize(HttpKernelInterface::class)->reveal(), $request, - HttpKernelInterface::MASTER_REQUEST, + HttpKernelInterface::MAIN_REQUEST, $handler_response ); $resource_response_subscriber->onResponse($event); @@ -146,7 +146,7 @@ public function testOnResponseWithCacheableResponse($methods, array $supported_r $event = new ResponseEvent( $this->prophesize(HttpKernelInterface::class)->reveal(), $request, - HttpKernelInterface::MASTER_REQUEST, + HttpKernelInterface::MAIN_REQUEST, $handler_response ); $resource_response_subscriber->onResponse($event); @@ -196,7 +196,7 @@ public function testOnResponseWithUncacheableResponse($methods, array $supported $event = new ResponseEvent( $this->prophesize(HttpKernelInterface::class)->reveal(), $request, - HttpKernelInterface::MASTER_REQUEST, + HttpKernelInterface::MAIN_REQUEST, $handler_response ); $resource_response_subscriber->onResponse($event); diff --git a/core/modules/serialization/tests/src/Unit/EventSubscriber/DefaultExceptionSubscriberTest.php b/core/modules/serialization/tests/src/Unit/EventSubscriber/DefaultExceptionSubscriberTest.php index 840de7e5ff26ec606066bf9fc8e9d9c6574e1ab1..ed09e27fc1cb006a819f30bba608b0663081b46e 100644 --- a/core/modules/serialization/tests/src/Unit/EventSubscriber/DefaultExceptionSubscriberTest.php +++ b/core/modules/serialization/tests/src/Unit/EventSubscriber/DefaultExceptionSubscriberTest.php @@ -27,7 +27,7 @@ public function testOn4xx() { $request->setRequestFormat('json'); $e = new MethodNotAllowedHttpException(['POST', 'PUT'], 'test message'); - $event = new ExceptionEvent($kernel->reveal(), $request, HttpKernelInterface::MASTER_REQUEST, $e); + $event = new ExceptionEvent($kernel->reveal(), $request, HttpKernelInterface::MAIN_REQUEST, $e); $subscriber = new DefaultExceptionSubscriber(new Serializer([], [new JsonEncoder()]), []); $subscriber->on4xx($event); $response = $event->getResponse(); diff --git a/core/modules/system/tests/modules/accept_header_routing_test/src/AcceptHeaderMiddleware.php b/core/modules/system/tests/modules/accept_header_routing_test/src/AcceptHeaderMiddleware.php index 45f2bb7c581315c016fb53bcc4c921b055ea7f17..371fa0f46c7adc41a114b21d2df80aa0e45e7441 100644 --- a/core/modules/system/tests/modules/accept_header_routing_test/src/AcceptHeaderMiddleware.php +++ b/core/modules/system/tests/modules/accept_header_routing_test/src/AcceptHeaderMiddleware.php @@ -24,7 +24,7 @@ public function __construct(HttpKernelInterface $app) { /** * {@inheritdoc} */ - public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = TRUE): Response { + public function handle(Request $request, $type = self::MAIN_REQUEST, $catch = TRUE): Response { $mapping = [ 'application/json' => 'json', 'application/hal+json' => 'hal_json', diff --git a/core/modules/system/tests/modules/error_service_test/src/MonkeysInTheControlRoom.php b/core/modules/system/tests/modules/error_service_test/src/MonkeysInTheControlRoom.php index 304d8ed93b6e597f79966312d899e515b65a718f..7df8d810f927effaebf169dbfe183f02ecff09ef 100644 --- a/core/modules/system/tests/modules/error_service_test/src/MonkeysInTheControlRoom.php +++ b/core/modules/system/tests/modules/error_service_test/src/MonkeysInTheControlRoom.php @@ -37,7 +37,7 @@ public function __construct(HttpKernelInterface $app, Settings $settings) { /** * {@inheritdoc} */ - public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = TRUE): Response { + public function handle(Request $request, $type = self::MAIN_REQUEST, $catch = TRUE): Response { if (\Drupal::state()->get('error_service_test.break_bare_html_renderer')) { // Let the bedlam begin. // 1) Force a container rebuild. diff --git a/core/modules/system/tests/modules/form_test/src/StackMiddleware/FormTestMiddleware.php b/core/modules/system/tests/modules/form_test/src/StackMiddleware/FormTestMiddleware.php index 3db45b9c400ceadedfee7e414f87b45f4fa93110..ca23b1417b07f026764189bf0e31fdce4cd5c7c6 100644 --- a/core/modules/system/tests/modules/form_test/src/StackMiddleware/FormTestMiddleware.php +++ b/core/modules/system/tests/modules/form_test/src/StackMiddleware/FormTestMiddleware.php @@ -31,7 +31,7 @@ public function __construct(HttpKernelInterface $http_kernel) { /** * {@inheritdoc} */ - public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = TRUE): Response { + public function handle(Request $request, $type = self::MAIN_REQUEST, $catch = TRUE): Response { $response = $this->httpKernel->handle($request, $type, $catch); $response->headers->set('X-Form-Test-Stack-Middleware', 'invoked'); return $response; diff --git a/core/modules/system/tests/modules/httpkernel_test/src/HttpKernel/TestMiddleware.php b/core/modules/system/tests/modules/httpkernel_test/src/HttpKernel/TestMiddleware.php index 5bf54c3d9d471969beb29735ca79a8cdd9d28dd8..8cab8452f5c391c23bc30926fb66916342ad60a6 100644 --- a/core/modules/system/tests/modules/httpkernel_test/src/HttpKernel/TestMiddleware.php +++ b/core/modules/system/tests/modules/httpkernel_test/src/HttpKernel/TestMiddleware.php @@ -41,7 +41,7 @@ public function __construct(HttpKernelInterface $kernel, $optional_argument = NU /** * {@inheritdoc} */ - public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = TRUE): Response { + public function handle(Request $request, $type = self::MAIN_REQUEST, $catch = TRUE): Response { $request->attributes->set('_hello', 'world'); if ($request->attributes->has('_optional_argument')) { $request->attributes->set('_previous_optional_argument', $request->attributes->get('_optional_argument')); diff --git a/core/modules/system/tests/src/Kernel/TimezoneResolverTest.php b/core/modules/system/tests/src/Kernel/TimezoneResolverTest.php index d9a29332e5e60377b4c1a69bd521b917a043541e..ae7701f4702e1de75e059aeda17ca0352d96289d 100644 --- a/core/modules/system/tests/src/Kernel/TimezoneResolverTest.php +++ b/core/modules/system/tests/src/Kernel/TimezoneResolverTest.php @@ -45,7 +45,7 @@ public function testGetTimeZone() { $eventDispatcher = $this->container->get('event_dispatcher'); $kernel = $this->container->get('kernel'); - $eventDispatcher->dispatch(new RequestEvent($kernel, Request::create('http://www.example.com'), HttpKernelInterface::MASTER_REQUEST, KernelEvents::REQUEST)); + $eventDispatcher->dispatch(new RequestEvent($kernel, Request::create('http://www.example.com'), HttpKernelInterface::MAIN_REQUEST, KernelEvents::REQUEST)); $this->assertEquals('Australia/Adelaide', date_default_timezone_get()); diff --git a/core/tests/Drupal/KernelTests/Core/Ajax/CommandsTest.php b/core/tests/Drupal/KernelTests/Core/Ajax/CommandsTest.php index 487f3c6cd47b231a176185e4e8bab1ffbfc6ce92..b4480f160bb68547d6d1cb8fe5d8c275b726cb7b 100644 --- a/core/tests/Drupal/KernelTests/Core/Ajax/CommandsTest.php +++ b/core/tests/Drupal/KernelTests/Core/Ajax/CommandsTest.php @@ -43,7 +43,7 @@ public function testAttachedSettings() { $event = new ResponseEvent( \Drupal::service('http_kernel'), new Request(), - HttpKernelInterface::MASTER_REQUEST, + HttpKernelInterface::MAIN_REQUEST, $response ); $subscriber->onResponse($event); diff --git a/core/tests/Drupal/KernelTests/Core/Database/ReplicaKillSwitchTest.php b/core/tests/Drupal/KernelTests/Core/Database/ReplicaKillSwitchTest.php index 7df3f5979e7465944a6181e0f097d224512f7a6b..e37eae88c944144f16d9bfe699242df28f58bbc0 100644 --- a/core/tests/Drupal/KernelTests/Core/Database/ReplicaKillSwitchTest.php +++ b/core/tests/Drupal/KernelTests/Core/Database/ReplicaKillSwitchTest.php @@ -32,7 +32,7 @@ public function testSystemInitIgnoresSecondaries() { $service->trigger(); $class_loader = require $this->root . '/autoload.php'; $kernel = new DrupalKernel('testing', $class_loader, FALSE); - $event = new RequestEvent($kernel, Request::create('http://example.com'), HttpKernelInterface::MASTER_REQUEST); + $event = new RequestEvent($kernel, Request::create('http://example.com'), HttpKernelInterface::MAIN_REQUEST); $service->checkReplicaServer($event); $db1 = Database::getConnection('default', 'default'); diff --git a/core/tests/Drupal/KernelTests/Core/Http/BlockInterestCohortTest.php b/core/tests/Drupal/KernelTests/Core/Http/BlockInterestCohortTest.php index d1267ae5aa682b49a136f1edcc689d5f42029db0..10a7b00438943c5f4b4cd429613e108a4abc26ba 100644 --- a/core/tests/Drupal/KernelTests/Core/Http/BlockInterestCohortTest.php +++ b/core/tests/Drupal/KernelTests/Core/Http/BlockInterestCohortTest.php @@ -35,7 +35,7 @@ public function testExistingInterestCohortPolicy() { $kernel = \Drupal::service('http_kernel'); $request = Request::create('/'); $response = new Response('', 200, $headers); - $event = new ResponseEvent($kernel, $request, HttpKernelInterface::MASTER_REQUEST, $response); + $event = new ResponseEvent($kernel, $request, HttpKernelInterface::MAIN_REQUEST, $response); \Drupal::service('finish_response_subscriber')->onRespond($event); $this->assertSame($headers['Permissions-Policy'], $response->headers->get('Permissions-Policy')); @@ -50,7 +50,7 @@ public function testExistingPolicyHeader() { $kernel = \Drupal::service('http_kernel'); $request = Request::create('/'); $response = new Response('', 200, $headers); - $event = new ResponseEvent($kernel, $request, HttpKernelInterface::MASTER_REQUEST, $response); + $event = new ResponseEvent($kernel, $request, HttpKernelInterface::MAIN_REQUEST, $response); \Drupal::service('finish_response_subscriber')->onRespond($event); $this->assertSame($headers['Permissions-Policy'], $response->headers->get('Permissions-Policy')); diff --git a/core/tests/Drupal/KernelTests/Core/HttpKernel/StackKernelIntegrationTest.php b/core/tests/Drupal/KernelTests/Core/HttpKernel/StackKernelIntegrationTest.php index fc9c74ba7cc7624e23accb5bb8938dcdc8529136..6dee2fabcc3fb2fe6c1a86108358aa3c30c39b41 100644 --- a/core/tests/Drupal/KernelTests/Core/HttpKernel/StackKernelIntegrationTest.php +++ b/core/tests/Drupal/KernelTests/Core/HttpKernel/StackKernelIntegrationTest.php @@ -28,7 +28,7 @@ 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); + $http_kernel->handle($request, HttpKernelInterface::MAIN_REQUEST, FALSE); $this->assertEquals('world', $request->attributes->get('_hello')); $this->assertEquals('test_argument', $request->attributes->get('_previous_optional_argument')); diff --git a/core/tests/Drupal/Tests/Core/Ajax/AjaxResponseTest.php b/core/tests/Drupal/Tests/Core/Ajax/AjaxResponseTest.php index 2e2b93532bde4476f125917b0da1e637eff6ded3..050a63822e841779e39f40ff09ddb8d0a813c51f 100644 --- a/core/tests/Drupal/Tests/Core/Ajax/AjaxResponseTest.php +++ b/core/tests/Drupal/Tests/Core/Ajax/AjaxResponseTest.php @@ -83,7 +83,7 @@ public function testPrepareResponseForIeFormRequestsWithFileUpload() { $event = new ResponseEvent( $this->createMock('\Symfony\Component\HttpKernel\HttpKernelInterface'), $request, - HttpKernelInterface::MASTER_REQUEST, + HttpKernelInterface::MAIN_REQUEST, $response ); $subscriber->onResponse($event); diff --git a/core/tests/Drupal/Tests/Core/DrupalKernel/DrupalKernelLegacyTest.php b/core/tests/Drupal/Tests/Core/DrupalKernel/DrupalKernelLegacyTest.php index 9afef566f4fa62d9e328c44a1381a8d59a709835..f6034c35ad7e0f6476665dc3b0b10e5c35ecea23 100644 --- a/core/tests/Drupal/Tests/Core/DrupalKernel/DrupalKernelLegacyTest.php +++ b/core/tests/Drupal/Tests/Core/DrupalKernel/DrupalKernelLegacyTest.php @@ -21,7 +21,7 @@ class DrupalKernelLegacyTest extends UnitTestCase { public function testKernelEventDeprecation() { $kernel = $this->createMock(DrupalKernel::class); $request = $this->createMock(Request::class); - $event = new KernelEvent($kernel, $request, $kernel::MASTER_REQUEST); + $event = new KernelEvent($kernel, $request, $kernel::MAIN_REQUEST); $this->expectDeprecation('Since symfony/http-kernel 5.3: "Symfony\Component\HttpKernel\Event\KernelEvent::isMasterRequest()" is deprecated, use "isMainRequest()" instead.'); $this->assertTrue($event->isMasterRequest()); diff --git a/core/tests/Drupal/Tests/Core/EventSubscriber/ActiveLinkResponseFilterTest.php b/core/tests/Drupal/Tests/Core/EventSubscriber/ActiveLinkResponseFilterTest.php index 6d3be86b9b1138ad9e1b7551713c0b03697fbad0..5e5b06cfcc8f4c67780d8a92ae7446072efbb935 100644 --- a/core/tests/Drupal/Tests/Core/EventSubscriber/ActiveLinkResponseFilterTest.php +++ b/core/tests/Drupal/Tests/Core/EventSubscriber/ActiveLinkResponseFilterTest.php @@ -444,7 +444,7 @@ public function testOnlyHtml() { $subscriber->onResponse(new ResponseEvent( $this->prophesize(KernelInterface::class)->reveal(), $request_stack->getCurrentRequest(), - HttpKernelInterface::MASTER_REQUEST, + HttpKernelInterface::MAIN_REQUEST, $response )); $this->assertSame($response->getContent(), $content); @@ -480,7 +480,7 @@ public function testSkipCertainResponseTypes() { $subscriber->onResponse(new ResponseEvent( $this->prophesize(KernelInterface::class)->reveal(), $request_stack->getCurrentRequest(), - HttpKernelInterface::MASTER_REQUEST, + HttpKernelInterface::MAIN_REQUEST, $response )); @@ -492,7 +492,7 @@ public function testSkipCertainResponseTypes() { $subscriber->onResponse(new ResponseEvent( $this->prophesize(KernelInterface::class)->reveal(), $request_stack->getCurrentRequest(), - HttpKernelInterface::MASTER_REQUEST, + HttpKernelInterface::MAIN_REQUEST, $response )); } diff --git a/core/tests/Drupal/Tests/Core/EventSubscriber/CustomPageExceptionHtmlSubscriberTest.php b/core/tests/Drupal/Tests/Core/EventSubscriber/CustomPageExceptionHtmlSubscriberTest.php index 5367e6523b54e15458039c344975a9b3e56c236a..964220206cc4c9fefb975a01d92f5d94dceb879b 100644 --- a/core/tests/Drupal/Tests/Core/EventSubscriber/CustomPageExceptionHtmlSubscriberTest.php +++ b/core/tests/Drupal/Tests/Core/EventSubscriber/CustomPageExceptionHtmlSubscriberTest.php @@ -139,7 +139,7 @@ public function testHandleWithPostRequest() { return new HtmlResponse($request->getMethod()); }); - $event = new ExceptionEvent($this->kernel, $request, HttpKernelInterface::MASTER_REQUEST, new NotFoundHttpException('foo')); + $event = new ExceptionEvent($this->kernel, $request, HttpKernelInterface::MAIN_REQUEST, new NotFoundHttpException('foo')); $this->customPageSubscriber->onException($event); @@ -166,7 +166,7 @@ public function testHandleWithGetRequest() { return new Response($request->getMethod() . ' ' . UrlHelper::buildQuery($request->query->all())); }); - $event = new ExceptionEvent($this->kernel, $request, HttpKernelInterface::MASTER_REQUEST, new NotFoundHttpException('foo')); + $event = new ExceptionEvent($this->kernel, $request, HttpKernelInterface::MAIN_REQUEST, new NotFoundHttpException('foo')); $this->customPageSubscriber->onException($event); $response = $event->getResponse(); diff --git a/core/tests/Drupal/Tests/Core/EventSubscriber/ExceptionJsonSubscriberTest.php b/core/tests/Drupal/Tests/Core/EventSubscriber/ExceptionJsonSubscriberTest.php index 57d62d14ece95c3921360dbeb515edbf274fe91e..c8a33bce0a72d5cfdd5294575c33c0601e85b606 100644 --- a/core/tests/Drupal/Tests/Core/EventSubscriber/ExceptionJsonSubscriberTest.php +++ b/core/tests/Drupal/Tests/Core/EventSubscriber/ExceptionJsonSubscriberTest.php @@ -27,7 +27,7 @@ class ExceptionJsonSubscriberTest extends UnitTestCase { public function testOn4xx(HttpExceptionInterface $exception, $expected_response_class) { $kernel = $this->prophesize(HttpKernelInterface::class); $request = Request::create('/test'); - $event = new ExceptionEvent($kernel->reveal(), $request, HttpKernelInterface::MASTER_REQUEST, $exception); + $event = new ExceptionEvent($kernel->reveal(), $request, HttpKernelInterface::MAIN_REQUEST, $exception); $subscriber = new ExceptionJsonSubscriber(); $subscriber->on4xx($event); $response = $event->getResponse(); diff --git a/core/tests/Drupal/Tests/Core/EventSubscriber/FinalExceptionSubscriberTest.php b/core/tests/Drupal/Tests/Core/EventSubscriber/FinalExceptionSubscriberTest.php index 62bccf4971263bc9b44044069883f4f7eccaa252..4b6bc941e69b0a5f08b3753900176263f71a9e78 100644 --- a/core/tests/Drupal/Tests/Core/EventSubscriber/FinalExceptionSubscriberTest.php +++ b/core/tests/Drupal/Tests/Core/EventSubscriber/FinalExceptionSubscriberTest.php @@ -28,7 +28,7 @@ public function testOnExceptionWithUnknownFormat() { // of this so we'll hard code it here. $request->setRequestFormat('bananas'); $e = new MethodNotAllowedHttpException(['POST', 'PUT'], 'test message'); - $event = new ExceptionEvent($kernel->reveal(), $request, HttpKernelInterface::MASTER_REQUEST, $e); + $event = new ExceptionEvent($kernel->reveal(), $request, HttpKernelInterface::MAIN_REQUEST, $e); $subscriber = new TestDefaultExceptionSubscriber($config_factory); $subscriber->setStringTranslation($this->getStringTranslationStub()); $subscriber->onException($event); diff --git a/core/tests/Drupal/Tests/Core/EventSubscriber/OptionsRequestSubscriberTest.php b/core/tests/Drupal/Tests/Core/EventSubscriber/OptionsRequestSubscriberTest.php index 6a2e7b6fd7903e3e411689d77c02c2ba790e52b1..bcc51bb8abad413fc70eb1002c5d6ffc3e0481c5 100644 --- a/core/tests/Drupal/Tests/Core/EventSubscriber/OptionsRequestSubscriberTest.php +++ b/core/tests/Drupal/Tests/Core/EventSubscriber/OptionsRequestSubscriberTest.php @@ -28,7 +28,7 @@ public function testWithNonOptionRequest() { $route_provider->getRouteCollectionForRequest($request)->shouldNotBeCalled(); $subscriber = new OptionsRequestSubscriber($route_provider->reveal()); - $event = new RequestEvent($kernel->reveal(), $request, HttpKernelInterface::MASTER_REQUEST); + $event = new RequestEvent($kernel->reveal(), $request, HttpKernelInterface::MAIN_REQUEST); $subscriber->onRequest($event); $this->assertFalse($event->hasResponse()); @@ -45,7 +45,7 @@ public function testWithoutMatchingRoutes() { $route_provider->getRouteCollectionForRequest($request)->willReturn(new RouteCollection())->shouldBeCalled(); $subscriber = new OptionsRequestSubscriber($route_provider->reveal()); - $event = new RequestEvent($kernel->reveal(), $request, HttpKernelInterface::MASTER_REQUEST); + $event = new RequestEvent($kernel->reveal(), $request, HttpKernelInterface::MAIN_REQUEST); $subscriber->onRequest($event); $this->assertFalse($event->hasResponse()); @@ -63,7 +63,7 @@ public function testWithOptionsRequest(RouteCollection $collection, $expected_he $route_provider->getRouteCollectionForRequest($request)->willReturn($collection)->shouldBeCalled(); $subscriber = new OptionsRequestSubscriber($route_provider->reveal()); - $event = new RequestEvent($kernel->reveal(), $request, HttpKernelInterface::MASTER_REQUEST); + $event = new RequestEvent($kernel->reveal(), $request, HttpKernelInterface::MAIN_REQUEST); $subscriber->onRequest($event); $this->assertTrue($event->hasResponse()); diff --git a/core/tests/Drupal/Tests/Core/EventSubscriber/PsrResponseSubscriberTest.php b/core/tests/Drupal/Tests/Core/EventSubscriber/PsrResponseSubscriberTest.php index 7b166944761c9eee30c937a27974fe471acd2ba6..0abce89cd52ab81bff7fabb8ee0081205cdf39e0 100644 --- a/core/tests/Drupal/Tests/Core/EventSubscriber/PsrResponseSubscriberTest.php +++ b/core/tests/Drupal/Tests/Core/EventSubscriber/PsrResponseSubscriberTest.php @@ -85,7 +85,7 @@ protected function createEvent($controller_result) { return new ViewEvent( $this->createMock(HttpKernelInterface::class), $this->createMock(Request::class), - HttpKernelInterface::MASTER_REQUEST, + HttpKernelInterface::MAIN_REQUEST, $controller_result ); } diff --git a/core/tests/Drupal/Tests/Core/EventSubscriber/RssResponseRelativeUrlFilterTest.php b/core/tests/Drupal/Tests/Core/EventSubscriber/RssResponseRelativeUrlFilterTest.php index 92d85f05310b9a6db67ced4bd57fb20ea040bd7f..fe0dd1d170f56b7dc7854678f0701ff434be3574 100644 --- a/core/tests/Drupal/Tests/Core/EventSubscriber/RssResponseRelativeUrlFilterTest.php +++ b/core/tests/Drupal/Tests/Core/EventSubscriber/RssResponseRelativeUrlFilterTest.php @@ -116,7 +116,7 @@ public function testOnResponse($content, $expected_content) { $event = new ResponseEvent( $this->prophesize(HttpKernelInterface::class)->reveal(), Request::create('/'), - HttpKernelInterface::MASTER_REQUEST, + HttpKernelInterface::MAIN_REQUEST, new Response($content, 200, [ 'Content-Type' => 'application/rss+xml', ]) diff --git a/core/tests/Drupal/Tests/Core/Form/EventSubscriber/FormAjaxSubscriberTest.php b/core/tests/Drupal/Tests/Core/Form/EventSubscriber/FormAjaxSubscriberTest.php index 1f51ed6f40a52318ece2c0ccb1f61c13c22510cb..90581d84359600abb812e4eb2a6c01406a9b33ba 100644 --- a/core/tests/Drupal/Tests/Core/Form/EventSubscriber/FormAjaxSubscriberTest.php +++ b/core/tests/Drupal/Tests/Core/Form/EventSubscriber/FormAjaxSubscriberTest.php @@ -198,7 +198,7 @@ public function testOnExceptionBrokenPostRequest() { $exception = new BrokenPostRequestException(32 * 1e6); $request = new Request([FormBuilderInterface::AJAX_FORM_REQUEST => TRUE]); - $event = new ExceptionEvent($this->httpKernel, $request, HttpKernelInterface::MASTER_REQUEST, $exception); + $event = new ExceptionEvent($this->httpKernel, $request, HttpKernelInterface::MAIN_REQUEST, $exception); $this->subscriber->onException($event); $this->assertTrue($event->isAllowingCustomResponseCode()); $actual_response = $event->getResponse(); @@ -266,7 +266,7 @@ public function testOnExceptionNestedWrongException() { * @internal */ protected function assertResponseFromException(Request $request, \Exception $exception, ?Response $expected_response): void { - $this->event = new ExceptionEvent($this->httpKernel, $request, HttpKernelInterface::MASTER_REQUEST, $exception); + $this->event = new ExceptionEvent($this->httpKernel, $request, HttpKernelInterface::MAIN_REQUEST, $exception); $this->subscriber->onException($this->event); $this->assertSame($expected_response, $this->event->getResponse()); diff --git a/core/tests/Drupal/Tests/Core/StackMiddleware/NegotiationMiddlewareTest.php b/core/tests/Drupal/Tests/Core/StackMiddleware/NegotiationMiddlewareTest.php index bd1137de849520add6bb901e3fa3e700a76c6077..1af7579f91cdea52b58dd0d721875ee335208778 100644 --- a/core/tests/Drupal/Tests/Core/StackMiddleware/NegotiationMiddlewareTest.php +++ b/core/tests/Drupal/Tests/Core/StackMiddleware/NegotiationMiddlewareTest.php @@ -36,7 +36,7 @@ class NegotiationMiddlewareTest extends UnitTestCase { protected function setUp(): void { parent::setUp(); - $this->app = $this->prophesize(MockedHttpKernelInterface::class); + $this->app = $this->prophesize(HttpKernelInterface::class); $this->contentNegotiation = new StubNegotiationMiddleware($this->app->reveal()); } @@ -109,12 +109,18 @@ public function testHandle() { $request_mock->request = $request_data->reveal(); // Calling kernel app with default arguments. - $this->app->handle($request_mock, HttpKernelInterface::MASTER_REQUEST, TRUE) - ->shouldBeCalled(); + $this->app->handle($request_mock, HttpKernelInterface::MAIN_REQUEST, TRUE) + ->shouldBeCalled() + ->willReturn( + $this->createMock(Response::class) + ); $this->contentNegotiation->handle($request_mock); // Calling kernel app with specified arguments. $this->app->handle($request_mock, HttpKernelInterface::SUB_REQUEST, FALSE) - ->shouldBeCalled(); + ->shouldBeCalled() + ->willReturn( + $this->createMock(Response::class) + ); $this->contentNegotiation->handle($request_mock, HttpKernelInterface::SUB_REQUEST, FALSE); } @@ -122,7 +128,7 @@ public function testHandle() { * @covers ::registerFormat */ public function testSetFormat() { - $app = $this->createMock(MockedHttpKernelInterface::class); + $app = $this->createMock(HttpKernelInterface::class); $app->expects($this->once()) ->method('handle') ->will($this->returnValue($this->createMock(Response::class))); @@ -156,14 +162,3 @@ public function getContentType(Request $request) { } } - -/** - * Helper interface for the Symfony 6 version of the HttpKernelInterface. - * - * @todo Remove this interface when the Symfony 6 is in core. - */ -interface MockedHttpKernelInterface extends HttpKernelInterface { - - public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = TRUE): Response; - -} diff --git a/core/tests/Drupal/Tests/Core/StackMiddleware/ReverseProxyMiddlewareTest.php b/core/tests/Drupal/Tests/Core/StackMiddleware/ReverseProxyMiddlewareTest.php index 9823175f7112ab768240d419fe697bbf8cc356de..406c56079bc1a2f5bb2dc6cd9789990525a98f50 100644 --- a/core/tests/Drupal/Tests/Core/StackMiddleware/ReverseProxyMiddlewareTest.php +++ b/core/tests/Drupal/Tests/Core/StackMiddleware/ReverseProxyMiddlewareTest.php @@ -25,7 +25,10 @@ class ReverseProxyMiddlewareTest extends UnitTestCase { * {@inheritdoc} */ protected function setUp(): void { - $this->mockHttpKernel = $this->createMock(MockHttpKernelInterface::class); + $responseMock = $this->createMock(Response::class); + $this->mockHttpKernel = $this->createMock(HttpKernelInterface::class); + $this->mockHttpKernel->method('handle') + ->willReturn($responseMock); } /** @@ -106,14 +109,3 @@ protected function trustedHeadersAreSet(Settings $settings, $expected_trusted_he } } - -/** - * Helper interface for the Symfony 6 version of the HttpKernelInterface. - * - * @todo Remove this interface when the Symfony 6 is in core. - */ -interface MockHttpKernelInterface extends HttpKernelInterface { - - public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = TRUE): Response; - -}