Commit ba0ac0fd authored by larowlan's avatar larowlan

Issue #2795085 by naveenvalecha, GoZ, dawehner, Lendude: Add assertNoCacheTag to assertLegacyTrait

parent 481b588b
......@@ -719,6 +719,22 @@ protected function assertCacheTag($expected_cache_tag) {
$this->assertSession()->responseHeaderContains('X-Drupal-Cache-Tags', $expected_cache_tag);
}
/**
* Asserts whether an expected cache tag was absent in the last response.
*
* @param string $cache_tag
* The cache tag to check.
*
* @deprecated Scheduled for removal in Drupal 9.0.0.
* Use $this->assertSession()->responseHeaderNotContains() instead.
*
* @see https://www.drupal.org/node/2864029
*/
protected function assertNoCacheTag($cache_tag) {
@trigger_error('assertNoCacheTag() 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-Tags', $cache_tag);
}
/**
* Checks that current response header equals value.
*
......
......@@ -165,6 +165,17 @@ public function testAssertNoPattern() {
$this->assertNoPattern('/.*foo$/');
}
/**
* @covers ::assertNoCacheTag
*/
public function testAssertNoCacheTag() {
$this->webAssert
->responseHeaderNotContains('X-Drupal-Cache-Tags', 'some-cache-tag')
->shouldBeCalled();
$this->assertNoCacheTag('some-cache-tag');
}
/**
* Returns a mocked behat session object.
*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment