[PP-1] Deprecate "helpers" for WebAssert::responseHeaderEquals and UiHelperTrait::submitForm

Created on 11 December 2023, 9 months ago
Updated 5 July 2024, 2 months ago

Problem/Motivation

In 📌 Update Behat from 1.10 to 1.11 Active we've added "helpers" to\Drupal\Tests\WebAssert::responseHeaderEquals(string $name, $value) (use responseHeaderDoesNotExist when $value is null) and \Drupal\Tests\UiHelperTrait::submitForm (Mink only allows strings for text, number and radio button values.) to appease an update from behat/mink* with stricter typing.

Since we were too close to a release of 10.2.0, we couldn't add those with proper fixes and deprecations for these helpers.

Whilst we did that, we also discovered an existing helper in \Drupal\Tests\UiHelperTrait::submitForm (Provide support for the values '1' and '0' for checkboxes instead of TRUE and FALSE.) that needs fixing and deprecation.

Steps to reproduce

Proposed resolution

Deprecate in 10.3.0 for removal in 11.0.0:

- Calling \Drupal\Tests\WebAssert::responseHeaderEquals(string $name, $value) with a <code>$value of NULL.
- Casting to string for text, number and radio button values in \Drupal\Tests\UiHelperTrait::submitForm.
- Casting to '0'/'1' from TRUE/FALSE string for checkbox values in \Drupal\Tests\UiHelperTrait::submitForm.

Fix all deprecations in core that are found for the above.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

📌 Task
Status

Active

Version

11.0 🔥

Component
PHPUnit 

Last updated about 12 hours ago

Created by

🇳🇱Netherlands Spokje

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

Comments & Activities

  • Issue created by @Spokje
  • Status changed to Postponed 9 months ago
  • 🇳🇱Netherlands Spokje

    Postponed on 📌 Update Behat from 1.10 to 1.11 Active and a 10.3.x branch

  • Status changed to Active 2 months ago
  • 🇺🇸United States TR Cascadia

    Reopening, because 📌 Update Behat from 1.10 to 1.11 Active has been fixed for a while and 10.3 is already out... What needs to be done here?

    I am encountering this error when testing with core Drupal 10.2:

       Drupal\Tests\honeypot\Functional\HoneypotFormCacheTest::testCacheCommentForm
        TypeError: Behat\Mink\WebAssert::responseHeaderEquals(): Argument #2 ($value) must be of type string, null given, called in
        /builds/project/honeypot/tests/src/Functional/HoneypotFormCacheTest.php on line 138

    There are no change records that mention this change and what the replacement is.

    I need to know when this deprecation was introduced, and when the replacement method responseHeaderDoesNotExist() was introduced into core, so that I can update my test for this change and set my module's core dependencies properly.

Production build 0.71.5 2024