diff --git a/tests/src/Functional/ResourceTestBase.php b/tests/src/Functional/ResourceTestBase.php index 9603855..d84f9a3 100644 --- a/tests/src/Functional/ResourceTestBase.php +++ b/tests/src/Functional/ResourceTestBase.php @@ -912,8 +912,8 @@ abstract class ResourceTestBase extends BrowserTestBase { $expected_document['data']['attributes'] = array_intersect_key($expected_document['data']['attributes'], [$label_field_name => TRUE]); unset($expected_document['data']['relationships']); // MISS or UNCACHEABLE depends on data. It must not be HIT. - $dynamic_cache = !empty(array_intersect(['user', 'session'], $this->getExpectedCacheContexts())) ? 'UNCACHEABLE' : 'MISS'; - $this->assertResourceResponse(200, $expected_document, $response, $this->getExpectedCacheTags(), $this->getExpectedCacheContexts(), FALSE, $dynamic_cache); + $dynamic_cache_label_only = !empty(array_intersect(['user', 'session'], $this->getExpectedCacheContexts([$label_field_name]))) ? 'UNCACHEABLE' : 'MISS'; + $this->assertResourceResponse(200, $expected_document, $response, $this->getExpectedCacheTags(), $this->getExpectedCacheContexts([$label_field_name]), FALSE, $dynamic_cache_label_only); } $this->setUpAuthorization('GET'); @@ -984,7 +984,7 @@ abstract class ResourceTestBase extends BrowserTestBase { } } $this->assertTrue($found_cache_redirect); - $this->assertSame($dynamic_cache !== 'UNCACHEABLE', $found_cached_200_response); + $this->assertSame($dynamic_cache !== 'UNCACHEABLE' || isset($dynamic_cache_label_only) && $dynamic_cache_label_only !== 'UNCACHEABLE', $found_cached_200_response); $this->assertTrue($other_cached_responses_are_4xx); // Not only assert the normalization, also assert deserialization of the