Issue #3248810 by daffie: [Symfony 6] The Drupal\Tests\jsonapi\Kernel\EventSubscriber\ResourceObjectNormalizerCacherTest fails with Symfony 5

merge-requests/1429/head
catch 2021-11-16 14:22:30 +00:00
parent 3795c75c97
commit b9fd8ef3d5
1 changed files with 9 additions and 2 deletions

View File

@ -9,7 +9,10 @@ use Drupal\jsonapi\JsonApiResource\ResourceObject;
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 @@ class ResourceObjectNormalizerCacherTest extends KernelTestBase {
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));