As suggested by @Cottser on #500866: [META] remove t() from assert message, this is a new issue to pick up the stragglers from the t() clean-up in assert messages and groups.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

lazysoundsystem’s picture

Assigned: lazysoundsystem » Unassigned
Status: Active » Needs review
FileSize
21.54 KB

Here's the patch for 8.x.

Crell’s picture

+++ b/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php
@@ -482,7 +482,7 @@ protected function drupalCreateUser(array $permissions = array(), $name = NULL)
+    $this->assertTrue(!empty($account->uid), format_string('User created with name %name and pass %pass', array('%name' => $edit['name'], '%pass' => $edit['pass'])), 'User login');

Please use Drupal\Component\Utility\String::format() instead of format_string(). There's several places in this patch that need that change.

lazysoundsystem’s picture

Thanks for the quick feedback. I think this one is better.

Crell’s picture

Status: Needs review » Needs work
+++ b/core/modules/system/lib/Drupal/system/Tests/System/DefaultMobileMetaTagsTest.php
@@ -34,7 +34,7 @@ function setUp() {
+      $this->assertRaw($metatag, format_string('Default Mobile meta tag "@name" displayed properly.', array('@name' => $name)), 'System');

Missed a format_string().

+++ b/core/modules/system/lib/Drupal/system/Tests/System/DefaultMobileMetaTagsTest.php
@@ -45,7 +45,7 @@ public function testRemovingDefaultMetaTags() {
+      $this->assertNoRaw($metatag, format_string('Default Mobile meta tag "@name" removed properly.', array('@name' => $name)), 'System');

Missed a format_string().

lazysoundsystem’s picture

Thanks - I wasn't sure whether to change those two as they were already there (and there are thousands of other format_string() calls in the tests that need changing, which I'll happily do in a separate issue.)

Here they are removed.

lazysoundsystem’s picture

Status: Needs work » Needs review

Setting back to 'needs review'.

Crell’s picture

Status: Needs review » Reviewed & tested by the community

That's always a gray area. :-) This looks good for now. Thanks!

jhodgdon’s picture

Status: Reviewed & tested by the community » Fixed

Thanks! Committed this one to 8.x. I don't think it probably needs backporting to 7.x?

lazysoundsystem’s picture

Version: 8.x-dev » 7.x-dev

I think 'needs' is too strong, but there are quite a few of these remaining in the 7.x tests.

I looked through the original list and found the following modules still have outstanding t()s - with an approximate number of instances in parentheses (I haven't checked they all should be removed):

blog (20), dashboard (17), profile (28) and trigger (15) (these have no 8.x equivalents and so got overlooked)
simpletest (85) - the 7.x patch was a straight port of the 8.x patch, and so there are many instances remaining in tests which aren't in 8.x
system (10), menu (1) and node (1).

jhodgdon’s picture

Let's file a separate issue for the 7.x "remaining changes" clean-up, since I think they aren't really the same ones covered in this issue. OK?

Crell’s picture

Version: 7.x-dev » 8.x-dev

Agreed on new issue for D7.

Status: Fixed » Closed (fixed)

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