Problem/Motivation

Drupal\Tests\captcha\Functional\CaptchaCacheTest::testCacheTags is failing due to changes in Drupal 11.1. See details here: Page Cache & Dynamic Page Cache modules' response headers improved

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Issue fork captcha-3497314

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

murat_kekic created an issue. See original summary.

murat_kekic’s picture

Assigned: murat_kekic » Unassigned

Despite there are no failing tests, the pipeline is still failing. I can't figure out why just from the logs. Can someone take a look?

murat_kekic’s picture

Status: Active » Needs work

dlevchik made their first commit to this issue’s fork.

dlevchik’s picture

Status: Needs work » Needs review

Fixed tests for D11. Fixed deprecations, like

Creation of dynamic properties is deprecated

or

Deprecated: mb_strtolower(): Passing null to parameter #1 ($string) of type string is deprecated in /builds/issue/captcha-3497314/web/core/lib/Drupal/Core/Config/Entity/Query/Condition.php on line 39

This last one is drupal core fault, when saving new config entity on preSave() it tries to load existing entity by uuid in core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php line 308. I didn't find the issue for this on drupal core issues. So now we just pre-fill uuid on new CaptchaPoint creation in captcha_set_form_id_setting()

To fix the tests I've added this condition:

// @see https://www.drupal.org/node/2958442
    // This is to support "phpunit (previous minor)"
    $pre_headers_changed = $header === NULL;
    if ($pre_headers_changed) {
      $this->assertNull($this->getSession()->getResponseHeader('x-drupal-cache'), 'Cache is disabled');
    }
    else {
      $this->assertEquals($this->getSession()->getResponseHeader('x-drupal-cache'), 'UNCACHEABLE (response policy)', 'Cache is disabled');
    }

This is not ideal, and I believe instead of doing this we may consider to make "phpunit (previous minor)" pipeline optional and allow it to fail, to better support D11. But, considering most of the users are still on D10, this can be done later in the future

anybody’s picture

Status: Needs review » Reviewed & tested by the community

Very nice work, thanks you!

  • anybody committed fbb023b6 on 2.x authored by murat_kekic
    Issue #3497314 by murat_kekic, dlevchik: Tests are failing for Drupal 11...
anybody’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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