Tests are failing for Drupal 11.1

Created on 4 January 2025, 3 months ago

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

🐛 Bug report
Status

Active

Version

2.0

Component

Tests

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @jErry_jakcson
  • Pipeline finished with Failed
    3 months ago
    Total: 2508s
    #385636
  • Despite there are no failing tests, the pipeline is still failing. I can't figure out why just from the logs. Can someone with more knowledge take a look?

  • First commit to issue fork.
  • Pipeline finished with Success
    3 months ago
    Total: 372s
    #404771
  • 🇵🇱Poland dlevchik Poznan, Poland

    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

Production build 0.71.5 2024