Loading core/modules/jsonapi/tests/src/Kernel/EventSubscriber/ResourceObjectNormalizerCacherTest.php +9 −2 Original line number Diff line number Diff line Loading @@ -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 Loading Loading @@ -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)); Loading Loading
core/modules/jsonapi/tests/src/Kernel/EventSubscriber/ResourceObjectNormalizerCacherTest.php +9 −2 Original line number Diff line number Diff line Loading @@ -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 Loading Loading @@ -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)); Loading