diff --git a/core/modules/jsonapi/tests/src/Functional/ResourceTestBase.php b/core/modules/jsonapi/tests/src/Functional/ResourceTestBase.php
index 18944192d5..d75d0b061c 100644
--- a/core/modules/jsonapi/tests/src/Functional/ResourceTestBase.php
+++ b/core/modules/jsonapi/tests/src/Functional/ResourceTestBase.php
@@ -1025,6 +1025,7 @@ public function testGetIndividual() {
       'X-Drupal-Dynamic-Cache',
       'Transfer-Encoding',
       'Vary',
+      'Server-Timing',
     ];
     $header_cleaner = function ($headers) use ($ignored_headers) {
       foreach ($headers as $header => $value) {
diff --git a/core/tests/Drupal/Tests/Core/StackMiddleware/ServerTimingTest.php b/core/tests/Drupal/Tests/Core/StackMiddleware/ServerTimingTest.php
index e6024ad0e1..ea0f7a9331 100644
--- a/core/tests/Drupal/Tests/Core/StackMiddleware/ServerTimingTest.php
+++ b/core/tests/Drupal/Tests/Core/StackMiddleware/ServerTimingTest.php
@@ -4,8 +4,11 @@
 
 use Drupal\Core\StackMiddleware\ServerTiming;
 use Drupal\Tests\UnitTestCase;
+use Prophecy\Argument;
 use Symfony\Bridge\PhpUnit\ClockMock;
+use Symfony\Component\HttpFoundation\Request;
 use Symfony\Component\HttpFoundation\Response;
+use Symfony\Component\HttpKernel\HttpKernelInterface;
 
 /**
  * Tests the ServerTiming middleware.
@@ -23,13 +26,13 @@ public function testServerTiming() {
     ClockMock::register(__CLASS__);
     ClockMock::withClockMock($_SERVER['REQUEST_TIME_FLOAT'] + 0.123123);
 
-    $http_kernel = $this->createMock('Symfony\Component\HttpKernel\HttpKernelInterface');
-    $http_kernel->method('handle')->willReturn(new Response());
-    $middleware = new ServerTiming($http_kernel);
-    $request = $this->createMock('Symfony\Component\HttpFoundation\Request');
+    $http_kernel = $this->prophesize(HttpKernelInterface::class);
+    $http_kernel->handle(Argument::type(Request::class), HttpKernelInterface::MASTER_REQUEST, TRUE)
+      ->willReturn(new Response());
 
-    $response = $middleware->handle($request);
-    self::assertEquals('total;desc="Page execution time";dur=123.12', $response->headers->get('Server-Timing'));
+    $middleware = new ServerTiming($http_kernel->reveal());
+    $response = $middleware->handle(new Request());
+    self::assertSame('total;desc="Page execution time";dur=123.12', $response->headers->get('Server-Timing'));
 
     ClockMock::withClockMock(false);
   }
