Commit 580535ba authored by catch's avatar catch
Browse files

Issue #3248810 by daffie: [Symfony 6] The...

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

(cherry picked from commit b9fd8ef3)
parent 5cf24e8a
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -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));