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
Branches
No related tags found
1 merge request!11983Issue #3521857 by jwilson3: Update file type icons to use SVG
Pipeline #475090 passed with warnings
Pipeline: drupal

#475101

    Pipeline: drupal

    #475096

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