From e368cfa341aec8f8010389a51b34a663ff83515f Mon Sep 17 00:00:00 2001 From: GoZ Date: Sat, 25 Mar 2017 18:00:33 +0100 Subject: [PATCH] Issue #2795085: Add assertNoCacheTag/assertCacheContext to assertLegacyTrait --- .../Drupal/FunctionalTests/AssertLegacyTrait.php | 32 ++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/core/tests/Drupal/FunctionalTests/AssertLegacyTrait.php b/core/tests/Drupal/FunctionalTests/AssertLegacyTrait.php index 79653da..5b18f38 100644 --- a/core/tests/Drupal/FunctionalTests/AssertLegacyTrait.php +++ b/core/tests/Drupal/FunctionalTests/AssertLegacyTrait.php @@ -681,6 +681,38 @@ protected function assertCacheTag($expected_cache_tag) { } /** + * Asserts whether an expected cache context was present in the last response. + * + * @param string $expected_cache_context + * The expected cache context. + * + * @deprecated Scheduled for removal in Drupal 9.0.0. + * Use $this->assertSession()->responseHeaderContains() instead. + * + * @see https://www.drupal.org/node/2864029 + */ + protected function assertCacheContext($expected_cache_context) { + @trigger_error('assertCacheContext() is deprecated and scheduled for removal in Drupal 9.0.0. Use $this->assertSession()->responseHeaderContains() instead. See https://www.drupal.org/node/2864029.', E_USER_DEPRECATED); + $this->assertSession()->responseHeaderContains('X-Drupal-Cache-Contexts', $expected_cache_context); + } + + /** + * Asserts that a cache context was not present in the last response. + * + * @param string $not_expected_cache_context + * The expected cache context. + * + * @deprecated Scheduled for removal in Drupal 9.0.0. + * Use $this->assertSession()->responseHeaderNotContains() instead. + * + * @see https://www.drupal.org/node/2864029 + */ + protected function assertNoCacheContext($not_expected_cache_context) { + @trigger_error('assertNoCacheContext() is deprecated and scheduled for removal in Drupal 9.0.0. Use $this->assertSession()->responseHeaderNotContains() instead. See https://www.drupal.org/node/2864029.', E_USER_DEPRECATED); + $this->assertSession()->responseHeaderNotContains('X-Drupal-Cache-Contexts', $not_expected_cache_context); + } + + /** * Checks that current response header equals value. * * @param string $name -- 2.8.1