diff --git a/core/modules/rest/tests/src/Functional/EntityResource/EntityResourceTestBase.php b/core/modules/rest/tests/src/Functional/EntityResource/EntityResourceTestBase.php index e9ca8d6a17..a0a2cc1edd 100644 --- a/core/modules/rest/tests/src/Functional/EntityResource/EntityResourceTestBase.php +++ b/core/modules/rest/tests/src/Functional/EntityResource/EntityResourceTestBase.php @@ -524,19 +524,18 @@ public function testGet() { // @see \Drupal\rest\EventSubscriber\ResourceResponseSubscriber::flattenResponse() $cache_items = $this->container->get('database') ->select('cache_dynamic_page_cache', 'c') - ->fields('c', ['cid', 'data']) + ->fields('c', ['data']) ->condition('c.cid', '%[route]=rest.%', 'LIKE') ->execute() - ->fetchAllAssoc('cid'); + ->fetchAll(); if (!$is_cacheable_by_dynamic_page_cache) { $this->assertCount(0, $cache_items); } else { - $this->assertCount(2, $cache_items); - $found_cache_redirect = FALSE; + $this->assertNotEmpty($cache_items); $found_cached_200_response = FALSE; $other_cached_responses_are_4xx = TRUE; - foreach ($cache_items as $cid => $cache_item) { + foreach ($cache_items as $cache_item) { $cached_data = unserialize($cache_item->data); if (!isset($cached_data['#cache_redirect'])) { $cached_response = $cached_data['#response']; @@ -549,11 +548,7 @@ public function testGet() { $this->assertNotInstanceOf(ResourceResponseInterface::class, $cached_response); $this->assertInstanceOf(CacheableResponseInterface::class, $cached_response); } - else { - $found_cache_redirect = TRUE; - } } - $this->assertTrue($found_cache_redirect); $this->assertTrue($found_cached_200_response); $this->assertTrue($other_cached_responses_are_4xx); }