Problem/Motivation

This issue is a child issue from #3145418: [November 9, 2020] Remove uses of t() in assertText() calls because if fix uses of t() in assertNoText() the patch would be to big and difficult to review.

Proposed resolution

Fix uses of t() in assertNoText(). Tests should not have t() calls inside assertNoText(). Only if it is testing translation.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

paulocs created an issue. See original summary.

paulocs’s picture

I will work on it.

paulocs’s picture

Assigned: paulocs » Unassigned
Status: Active » Needs review
FileSize
76.95 KB

Patch to remove all t() calls inside assertNoText().
Please review it.

Cheers, Paulo

Status: Needs review » Needs work

The last submitted patch, 3: 3166349-2.patch, failed testing. View results

paulocs’s picture

Status: Needs work » Needs review
FileSize
76.17 KB
2.03 KB

Fixing errors.

Status: Needs review » Needs work

The last submitted patch, 5: 3166349-3.patch, failed testing. View results

naresh_bavaskar’s picture

Assigned: Unassigned » naresh_bavaskar
naresh_bavaskar’s picture

Assigned: naresh_bavaskar » Unassigned
Status: Needs work » Needs review

#5 patch looks good to me..might random test cases were failed. trying to re-upload it.

naresh_bavaskar’s picture

Status: Needs review » Needs work

The last submitted patch, 9: 3166349-3.patch, failed testing. View results

mondrake’s picture

  1. +++ b/core/modules/contact/tests/src/Functional/ContactSitewideTest.php
    @@ -226,7 +226,7 @@ public function testSiteWideContact() {
         $this->addContactForm($name, $label, '', '', FALSE);
    -    $this->assertNoText(t('Contact form @label has been added.', ['@label' => $label]));
    +    $this->assertNoText('Contact form $label has been added.');
    ...
     
    

    The string should be enclosed in double quotes (") in order for $label to be replaced with the variable's value.

  2. +++ b/core/modules/forum/tests/src/Functional/ForumTest.php
    @@ -581,7 +581,7 @@ public function createForumTopic($forum, $container = FALSE) {
    +      $this->assertNoText('$type $title has been created.', 'Forum topic was not created');
    

    same

  3. +++ b/core/modules/user/tests/src/Functional/UserPasswordResetTest.php
    @@ -375,7 +375,7 @@ public function testUserResetPasswordUserFloodControlIsCleared() {
    -    $this->assertNoText(t('Sorry, @name is not recognized as a username or an e-mail address.', ['@name' => $name]), 'Validation error message shown when trying to request password for invalid account.');
    +    $this->assertNoText('Sorry, $name is not recognized as a username or an e-mail address.', 'Validation error message shown when trying to request password for invalid account.');
    

    same

snehalgaikwad’s picture

Status: Needs work » Needs review
FileSize
76.02 KB
2.43 KB

Changed string quotes to double as per #11.

mondrake’s picture

Status: Needs review » Reviewed & tested by the community

Thank you.

mondrake’s picture

Issue tags: +Deprecated assertions

  • catch committed f4fd2d7 on 9.1.x
    Issue #3166349 by paulocs, snehalgaikwad, naresh_bavaskar, mondrake:...
catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed f4fd2d7 and pushed to 9.1.x. Thanks!

Status: Fixed » Closed (fixed)

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