Remove t() from tests that are not testing translation

Created on 5 February 2024, 5 months ago
Updated 20 February 2024, 4 months ago

Problem/Motivation

The phpunit jobs in GitLab CI are sometimes failing with this:

1) Drupal\Tests\address\FunctionalJavascript\AddressDefaultWidgetTest::testCountries
TypeError: Behat\Mink\Element\TraversableElement::findButton(): Argument #1 ($locator) must be of type string, Drupal\Core\StringTranslation\TranslatableMarkup given, called in /builds/project/address/web/core/tests/Drupal/Tests/WebAssert.php on line 143
/builds/project/address/vendor/behat/mink/src/Element/TraversableElement.php:97
/builds/project/address/web/core/tests/Drupal/Tests/WebAssert.php:143
/builds/project/address/web/core/tests/Drupal/Tests/UiHelperTrait.php:78
/builds/project/address/tests/src/FunctionalJavascript/AddressDefaultWidgetTest.php:193
/builds/project/address/vendor/phpunit/phpunit/src/Framework/TestResult.php:728

That comes from:

    $this->submitForm($edit, $this->t('Save settings'));

Unless we're testing translation, we don't want to use t() in tests.

Steps to reproduce

Proposed resolution

Remove t() from tests except where we're actually testing translatability.

Remaining tasks

User interface changes

API changes

Data model changes

πŸ“Œ Task
Status

Fixed

Version

2.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States dww

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

Merge Requests

Comments & Activities

Production build 0.69.0 2024