Problem/Motivation
While working on #3131186: Replace assertions involving calls to drupalGetHeader() with session-based assertions, where possible, I realized there are cases like
$this->assertSame('HIT', $this->getSession()->getResponseHeader('X-Drupal-Dynamic-Cache'));
that are better covered by direct usage of the appropriate WebAssert method, like in this case would be:
$this->assertSession()->responseHeaderEquals('X-Drupal-Dynamic-Cache', 'HIT');
Regex for finding: getSession\(\)->getResponseHeader\(
Steps to reproduce
Proposed resolution
Replace the instances.
Remaining tasks
User interface changes
no
API changes
no
Data model changes
no
Release notes snippet
no
Comments
Comment #2
mondrakeComment #3
mondrakeComment #4
s_bhandari commentedHi,
I am working on it. Will update on this as soon as possible.
Thanks.
Comment #5
s_bhandari commentedHi,
Applied a patch for the same. Please review it and let me know for any observation.
Thanks.
Comment #6
mondrakeComment #7
suresh prabhu parkala commentedPlease review!
Comment #8
longwaveThanks for working on this. This only covers NodeBlockFunctionalTest so far, a search of the codebase shows there are about another 20 cases to consider.
Comment #9
ankithashettyComment #10
ankithashettyUpdated the patch and attached an interdiff along with it. Kindly review the same.
Thank you.
Comment #11
ankithashettyUpdated the patch. Please review.
Comment #12
longwaveThis is looking good but I think there are still some calls we can replace in the following files:
Also:
$message is now redundant, I think we can just delete this line.
Comment #13
paulocsI'll work on it
Comment #14
paulocsUpdated patch with changes from comment #12 and also I did more changes on PageCacheTagsTestBase.php file.
Interdiff is also attached.
Cheers, Paulo.
Comment #15
longwaveThanks, this looks good now. I applied the patch and looked for remaining cases - there are three, but they have to stay as they aren't directly asserting anything:
Comment #17
catchCommitted/pushed to 9.1.x, thanks!
This is eligible for backport to 9.0.x and 8.9.x, but the patch doesn't cherry-pick - however I think it's OK to leave the commit in 9.1.x