Problem/Motivation

Found in #2737805: Convert web tests to browser tests for forum module that cache tags cannot be asserted because they are not returned in the HTTP responses.

Proposed resolution

BrowserTestBase needs to enable cache tags same as the deprecated WebTestBase does.

Remaining tasks

Patch.

User interface changes

None.

API changes

None.

Data model changes

None.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

klausi created an issue. See original summary.

klausi’s picture

Status: Active » Needs review
FileSize
4.15 KB

Patch.

larowlan’s picture

Status: Needs review » Reviewed & tested by the community

thx

dawehner’s picture

Perfect, reviewed the code in another issue already.

  • catch committed a055d6a on 8.2.x
    Issue #2751875 by klausi: BrowserTestBase must enable cache tags in...
catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed a055d6a and pushed to 8.2.x. Thanks!

dawehner’s picture

Version: 8.2.x-dev » 8.1.x-dev
Status: Fixed » Reviewed & tested by the community

Any reason this is not pushed to 8.1.x as well?

catch’s picture

Status: Reviewed & tested by the community » Fixed

No good reason, no.

  • catch committed 0349bb1 on 8.1.x
    Issue #2751875 by klausi: BrowserTestBase must enable cache tags in...
Wim Leers’s picture

Issue tags: +D8 cacheability
+++ b/core/tests/Drupal/Tests/BrowserTestBase.php
@@ -1104,6 +1109,10 @@ public function installDrupal() {
+    // During tests, cacheable responses should get the debugging cacheability
+    // headers by default.
+    $this->setContainerParameter('http.response.debug_cacheability_headers', TRUE);

Nice, this means parity with \Drupal\simpletest\WebTestBase::initSettings().

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.