diff --git a/core/lib/Drupal/Core/EventSubscriber/FinishResponseSubscriber.php b/core/lib/Drupal/Core/EventSubscriber/FinishResponseSubscriber.php index 3ac9914e09..5898d17ae6 100644 --- a/core/lib/Drupal/Core/EventSubscriber/FinishResponseSubscriber.php +++ b/core/lib/Drupal/Core/EventSubscriber/FinishResponseSubscriber.php @@ -299,8 +299,8 @@ protected function setExpiresNoCache(Response $response) { */ public static function getSubscribedEvents() { $events[KernelEvents::RESPONSE][] = array('onRespond'); - // Execute before the onRespond method. We went with prio 16 as we want to - // run before static::onRespond(). + // There is no specific reason for choosing 16 beside it should be executed + // before ::onRespond(). $events[KernelEvents::RESPONSE][] = array('onAllResponds', 16); return $events; } diff --git a/core/modules/rest/tests/src/Functional/EntityResource/Node/NodeResourceTestBase.php b/core/modules/rest/tests/src/Functional/EntityResource/Node/NodeResourceTestBase.php index 08cb581962..d7651c4b90 100644 --- a/core/modules/rest/tests/src/Functional/EntityResource/Node/NodeResourceTestBase.php +++ b/core/modules/rest/tests/src/Functional/EntityResource/Node/NodeResourceTestBase.php @@ -4,7 +4,6 @@ use Drupal\node\Entity\Node; use Drupal\node\Entity\NodeType; -use Drupal\rest\Entity\RestResourceConfig; use Drupal\Tests\rest\Functional\EntityResource\EntityResourceTestBase; use Drupal\user\Entity\User; diff --git a/core/modules/rest/tests/src/Functional/ResourceTestBase.php b/core/modules/rest/tests/src/Functional/ResourceTestBase.php index 4cde407744..db42927b79 100644 --- a/core/modules/rest/tests/src/Functional/ResourceTestBase.php +++ b/core/modules/rest/tests/src/Functional/ResourceTestBase.php @@ -131,7 +131,7 @@ public function setUp() { // Ensure there's a clean slate: delete all REST resource config entities. $this->resourceConfigStorage->delete($this->resourceConfigStorage->loadMultiple()); // If we remove resources we also need to ensure they don't stick in the - // router. + // {router} table. \Drupal::service('router.builder')->rebuild(); } @@ -155,6 +155,9 @@ protected function provisionResource($resource_type, $formats = [], $authenticat 'authentication' => $authentication, ] ])->save(); + // Ensure that the cache tags invalidator has its internal values reset. + // Otherwise the http_response cache tag invalidation won't work. + $this->refreshVariables(); \Drupal::service('router.builder')->rebuild(); }