Skip to content
Snippets Groups Projects
Verified Commit 45a1a667 authored by Dave Long's avatar Dave Long
Browse files

Issue #3493872 by heilop, kwolford121, joachim, dalin: Standardize property...

Issue #3493872 by heilop, kwolford121, joachim, dalin: Standardize property name of HTTP Kernel in Middleware classes
parent 99423203
No related branches found
No related tags found
3 merge requests!5423Draft: Resolve #3329907 "Test2",!3478Issue #3337882: Deleted menus are not removed from content type config,!579Issue #2230909: Simple decimals fail to pass validation
Pipeline #475090 passed with warnings
Pipeline: drupal

#475101

    Pipeline: drupal

    #475096

      ...@@ -16,7 +16,7 @@ class NegotiationMiddleware implements HttpKernelInterface { ...@@ -16,7 +16,7 @@ class NegotiationMiddleware implements HttpKernelInterface {
      * *
      * @var \Symfony\Component\HttpKernel\HttpKernelInterface * @var \Symfony\Component\HttpKernel\HttpKernelInterface
      */ */
      protected $app; protected $httpKernel;
      /** /**
      * Contains a hashmap of format as key and mimetype as value. * Contains a hashmap of format as key and mimetype as value.
      ...@@ -28,11 +28,11 @@ class NegotiationMiddleware implements HttpKernelInterface { ...@@ -28,11 +28,11 @@ class NegotiationMiddleware implements HttpKernelInterface {
      /** /**
      * Constructs a new NegotiationMiddleware. * Constructs a new NegotiationMiddleware.
      * *
      * @param \Symfony\Component\HttpKernel\HttpKernelInterface $app * @param \Symfony\Component\HttpKernel\HttpKernelInterface $http_kernel
      * The wrapper HTTP kernel. * The wrapper HTTP kernel.
      */ */
      public function __construct(HttpKernelInterface $app) { public function __construct(HttpKernelInterface $http_kernel) {
      $this->app = $app; $this->httpKernel = $http_kernel;
      } }
      /** /**
      ...@@ -48,7 +48,7 @@ public function handle(Request $request, $type = self::MAIN_REQUEST, $catch = TR ...@@ -48,7 +48,7 @@ public function handle(Request $request, $type = self::MAIN_REQUEST, $catch = TR
      if ($requested_format = $this->getContentType($request)) { if ($requested_format = $this->getContentType($request)) {
      $request->setRequestFormat($requested_format); $request->setRequestFormat($requested_format);
      } }
      return $this->app->handle($request, $type, $catch); return $this->httpKernel->handle($request, $type, $catch);
      } }
      /** /**
      ......
      ...@@ -22,7 +22,7 @@ class StackedHttpKernel implements HttpKernelInterface, TerminableInterface { ...@@ -22,7 +22,7 @@ class StackedHttpKernel implements HttpKernelInterface, TerminableInterface {
      * *
      * @var \Symfony\Component\HttpKernel\HttpKernelInterface * @var \Symfony\Component\HttpKernel\HttpKernelInterface
      */ */
      private $kernel; private $httpKernel;
      /** /**
      * A set of middlewares that are wrapped around this kernel. * A set of middlewares that are wrapped around this kernel.
      ...@@ -34,13 +34,13 @@ class StackedHttpKernel implements HttpKernelInterface, TerminableInterface { ...@@ -34,13 +34,13 @@ class StackedHttpKernel implements HttpKernelInterface, TerminableInterface {
      /** /**
      * Constructs a stacked HTTP kernel. * Constructs a stacked HTTP kernel.
      * *
      * @param \Symfony\Component\HttpKernel\HttpKernelInterface $kernel * @param \Symfony\Component\HttpKernel\HttpKernelInterface $http_kernel
      * The decorated kernel. * The decorated kernel.
      * @param array $middlewares * @param array $middlewares
      * An array of previous middleware services. * An array of previous middleware services.
      */ */
      public function __construct(HttpKernelInterface $kernel, array $middlewares) { public function __construct(HttpKernelInterface $http_kernel, array $middlewares) {
      $this->kernel = $kernel; $this->httpKernel = $http_kernel;
      $this->middlewares = $middlewares; $this->middlewares = $middlewares;
      } }
      ...@@ -48,7 +48,7 @@ public function __construct(HttpKernelInterface $kernel, array $middlewares) { ...@@ -48,7 +48,7 @@ public function __construct(HttpKernelInterface $kernel, array $middlewares) {
      * {@inheritdoc} * {@inheritdoc}
      */ */
      public function handle(Request $request, $type = HttpKernelInterface::MAIN_REQUEST, $catch = TRUE): Response { public function handle(Request $request, $type = HttpKernelInterface::MAIN_REQUEST, $catch = TRUE): Response {
      return $this->kernel->handle($request, $type, $catch); return $this->httpKernel->handle($request, $type, $catch);
      } }
      /** /**
      ......
      ...@@ -16,16 +16,16 @@ class AcceptHeaderMiddleware implements HttpKernelInterface { ...@@ -16,16 +16,16 @@ class AcceptHeaderMiddleware implements HttpKernelInterface {
      /** /**
      * The app kernel. * The app kernel.
      */ */
      protected HttpKernelInterface $app; protected HttpKernelInterface $httpKernel;
      /** /**
      * Constructs a new AcceptHeaderMiddleware instance. * Constructs a new AcceptHeaderMiddleware instance.
      * *
      * @param \Symfony\Component\HttpKernel\HttpKernelInterface $app * @param \Symfony\Component\HttpKernel\HttpKernelInterface $http_kernel
      * The app. * The app.
      */ */
      public function __construct(HttpKernelInterface $app) { public function __construct(HttpKernelInterface $http_kernel) {
      $this->app = $app; $this->httpKernel = $http_kernel;
      } }
      /** /**
      ...@@ -43,7 +43,7 @@ public function handle(Request $request, $type = self::MAIN_REQUEST, $catch = TR ...@@ -43,7 +43,7 @@ public function handle(Request $request, $type = self::MAIN_REQUEST, $catch = TR
      $request->setRequestFormat($mapping[$accept[0]]); $request->setRequestFormat($mapping[$accept[0]]);
      } }
      return $this->app->handle($request, $type, $catch); return $this->httpKernel->handle($request, $type, $catch);
      } }
      } }
      ...@@ -18,7 +18,7 @@ class TestMiddleware implements HttpKernelInterface { ...@@ -18,7 +18,7 @@ class TestMiddleware implements HttpKernelInterface {
      * *
      * @var \Symfony\Component\HttpKernel\HttpKernelInterface * @var \Symfony\Component\HttpKernel\HttpKernelInterface
      */ */
      protected $kernel; protected $httpKernel;
      /** /**
      * An optional argument. * An optional argument.
      ...@@ -30,13 +30,13 @@ class TestMiddleware implements HttpKernelInterface { ...@@ -30,13 +30,13 @@ class TestMiddleware implements HttpKernelInterface {
      /** /**
      * Constructs a new TestMiddleware object. * Constructs a new TestMiddleware object.
      * *
      * @param \Symfony\Component\HttpKernel\HttpKernelInterface $kernel * @param \Symfony\Component\HttpKernel\HttpKernelInterface $http_kernel
      * The decorated kernel. * The decorated kernel.
      * @param mixed $optional_argument * @param mixed $optional_argument
      * (optional) An optional argument. * (optional) An optional argument.
      */ */
      public function __construct(HttpKernelInterface $kernel, $optional_argument = NULL) { public function __construct(HttpKernelInterface $http_kernel, $optional_argument = NULL) {
      $this->kernel = $kernel; $this->httpKernel = $http_kernel;
      $this->optionalArgument = $optional_argument; $this->optionalArgument = $optional_argument;
      } }
      ...@@ -52,7 +52,7 @@ public function handle(Request $request, $type = self::MAIN_REQUEST, $catch = TR ...@@ -52,7 +52,7 @@ public function handle(Request $request, $type = self::MAIN_REQUEST, $catch = TR
      $request->attributes->set('_optional_argument', $this->optionalArgument); $request->attributes->set('_optional_argument', $this->optionalArgument);
      } }
      return $this->kernel->handle($request, $type, $catch); return $this->httpKernel->handle($request, $type, $catch);
      } }
      } }
      ...@@ -22,10 +22,10 @@ class ContentLengthTest extends UnitTestCase { ...@@ -22,10 +22,10 @@ class ContentLengthTest extends UnitTestCase {
      * @dataProvider providerTestSetContentLengthHeader * @dataProvider providerTestSetContentLengthHeader
      */ */
      public function testHandle(false|int $expected_header, Response $response): void { public function testHandle(false|int $expected_header, Response $response): void {
      $kernel = $this->prophesize(HttpKernelInterface::class); $httpKernel = $this->prophesize(HttpKernelInterface::class);
      $request = Request::create('/'); $request = Request::create('/');
      $kernel->handle($request, HttpKernelInterface::MAIN_REQUEST, TRUE)->willReturn($response); $httpKernel->handle($request, HttpKernelInterface::MAIN_REQUEST, TRUE)->willReturn($response);
      $middleware = new ContentLength($kernel->reveal()); $middleware = new ContentLength($httpKernel->reveal());
      $response = $middleware->handle($request); $response = $middleware->handle($request);
      if ($expected_header === FALSE) { if ($expected_header === FALSE) {
      $this->assertFalse($response->headers->has('Content-Length')); $this->assertFalse($response->headers->has('Content-Length'));
      ......
      ...@@ -20,7 +20,7 @@ class NegotiationMiddlewareTest extends UnitTestCase { ...@@ -20,7 +20,7 @@ class NegotiationMiddlewareTest extends UnitTestCase {
      /** /**
      * @var \Symfony\Component\HttpKernel\HttpKernelInterface * @var \Symfony\Component\HttpKernel\HttpKernelInterface
      */ */
      protected $app; protected $httpKernel;
      /** /**
      * @var \Drupal\Tests\Core\StackMiddleware\StubNegotiationMiddleware * @var \Drupal\Tests\Core\StackMiddleware\StubNegotiationMiddleware
      ...@@ -33,8 +33,8 @@ class NegotiationMiddlewareTest extends UnitTestCase { ...@@ -33,8 +33,8 @@ class NegotiationMiddlewareTest extends UnitTestCase {
      protected function setUp(): void { protected function setUp(): void {
      parent::setUp(); parent::setUp();
      $this->app = $this->prophesize(HttpKernelInterface::class); $this->httpKernel = $this->prophesize(HttpKernelInterface::class);
      $this->contentNegotiation = new StubNegotiationMiddleware($this->app->reveal()); $this->contentNegotiation = new StubNegotiationMiddleware($this->httpKernel->reveal());
      } }
      /** /**
      ...@@ -104,14 +104,14 @@ public function testHandle(): void { ...@@ -104,14 +104,14 @@ public function testHandle(): void {
      $request_mock->request = new InputBag(); $request_mock->request = new InputBag();
      // Calling kernel app with default arguments. // Calling kernel app with default arguments.
      $this->app->handle($request_mock, HttpKernelInterface::MAIN_REQUEST, TRUE) $this->httpKernel->handle($request_mock, HttpKernelInterface::MAIN_REQUEST, TRUE)
      ->shouldBeCalled() ->shouldBeCalled()
      ->willReturn( ->willReturn(
      $this->createMock(Response::class) $this->createMock(Response::class)
      ); );
      $this->contentNegotiation->handle($request_mock); $this->contentNegotiation->handle($request_mock);
      // Calling kernel app with specified arguments. // Calling kernel app with specified arguments.
      $this->app->handle($request_mock, HttpKernelInterface::SUB_REQUEST, FALSE) $this->httpKernel->handle($request_mock, HttpKernelInterface::SUB_REQUEST, FALSE)
      ->shouldBeCalled() ->shouldBeCalled()
      ->willReturn( ->willReturn(
      $this->createMock(Response::class) $this->createMock(Response::class)
      ...@@ -123,12 +123,12 @@ public function testHandle(): void { ...@@ -123,12 +123,12 @@ public function testHandle(): void {
      * @covers ::registerFormat * @covers ::registerFormat
      */ */
      public function testSetFormat(): void { public function testSetFormat(): void {
      $app = $this->createMock(HttpKernelInterface::class); $httpKernel = $this->createMock(HttpKernelInterface::class);
      $app->expects($this->once()) $httpKernel->expects($this->once())
      ->method('handle') ->method('handle')
      ->willReturn($this->createMock(Response::class)); ->willReturn($this->createMock(Response::class));
      $content_negotiation = new StubNegotiationMiddleware($app); $content_negotiation = new StubNegotiationMiddleware($httpKernel);
      $request = $this->prophesize(Request::class); $request = $this->prophesize(Request::class);
      ......
      0% Loading or .
      You are about to add 0 people to the discussion. Proceed with caution.
      Please register or to comment