From 580535ba56dae3bf36360192fe4cb04d46c1165d Mon Sep 17 00:00:00 2001 From: catch <catch@35733.no-reply.drupal.org> Date: Tue, 16 Nov 2021 14:22:30 +0000 Subject: [PATCH] Issue #3248810 by daffie: [Symfony 6] The Drupal\Tests\jsonapi\Kernel\EventSubscriber\ResourceObjectNormalizerCacherTest fails with Symfony 5 (cherry picked from commit b9fd8ef3d5f50f6afe51488adb0c81a5b6b9f4a4) --- .../ResourceObjectNormalizerCacherTest.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/core/modules/jsonapi/tests/src/Kernel/EventSubscriber/ResourceObjectNormalizerCacherTest.php b/core/modules/jsonapi/tests/src/Kernel/EventSubscriber/ResourceObjectNormalizerCacherTest.php index e715edc47e19..2d213e970f54 100644 --- a/core/modules/jsonapi/tests/src/Kernel/EventSubscriber/ResourceObjectNormalizerCacherTest.php +++ b/core/modules/jsonapi/tests/src/Kernel/EventSubscriber/ResourceObjectNormalizerCacherTest.php @@ -9,7 +9,10 @@ use Drupal\jsonapi\Normalizer\Value\CacheableNormalization; use Drupal\KernelTests\KernelTestBase; use Drupal\user\Entity\User; +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Event\TerminateEvent; +use Symfony\Component\HttpKernel\HttpKernelInterface; /** * @coversDefaultClass \Drupal\jsonapi\EventSubscriber\ResourceObjectNormalizationCacher @@ -92,8 +95,12 @@ public function testLinkNormalizationCacheability() { ResourceObjectNormalizationCacher::RESOURCE_CACHE_SUBSET_FIELDS => [], ]; $this->cacher->saveOnTerminate($resource_object, $normalization_parts); - $event = $this->prophesize(TerminateEvent::class); - $this->cacher->onTerminate($event->reveal()); + + $http_kernel = $this->prophesize(HttpKernelInterface::class); + $request = $this->prophesize(Request::class); + $response = $this->prophesize(Response::class); + $event = new TerminateEvent($http_kernel->reveal(), $request->reveal(), $response->reveal()); + $this->cacher->onTerminate($event); $this->assertNotFalse((bool) $this->cacher->get($resource_object)); Cache::invalidateTags([$cache_tag_to_invalidate]); $this->assertFalse((bool) $this->cacher->get($resource_object)); -- GitLab