This is a sub-task of #500866: [META] remove t() from assert message focused on the Xmlrpc module.

In D8 per http://drupal.org/simpletest-tutorial-drupal7#t, best practice is to remove t() from assert messages in tests. When necessary, t() should be replaced with format_string().

There are approximately 8 changes needed in two test files. This issue includes conversion of all format_patch() occurances as well.

Comments

lars toomre’s picture

Status: Active » Needs review
StatusFileSize
new4.05 KB

Here is an initial patch for this issue. It includes a couple of changes to format_string as I recall. Also be careful in reviewing as some assertions look odd from afar.

xjm’s picture

Assigned: Unassigned » jhodgdon
Status: Needs review » Reviewed & tested by the community
Issue tags: +Needs backport to D7

I checked in XmlRpcBasicTest::testInvalidMessageParsing(). Here's how that array of messages is used:

foreach ($invalid_messages as $assertion) {
    $this->assertFalse(xmlrpc_message_parse($assertion['message']), $assertion['assertion']
}

So that change looks correct to me.

+++ b/core/modules/xmlrpc/lib/Drupal/xmlrpc/Tests/XmlRpcBasicTest.phpundefined
@@ -64,7 +64,7 @@ class XmlRpcBasicTest extends WebTestBase {
     $signature = xmlrpc($url, array('system.methodSignature' => array('system.listMethods')));
     $this->assert(is_array($signature) && !empty($signature) && is_array($signature[0]),
-      t('system.methodSignature returns an array of signature arrays.'));
+      'system.methodSignature returns an array of signature arrays.');

Out of scope here, but I think this should use assertTrue() rather than assert() for clarity. (See TestBase::assert().) Can we file a followup novice issue for that?

All the changes are correct, so RTBC.

jhodgdon’s picture

Version: 8.x-dev » 7.x-dev
Status: Reviewed & tested by the community » Patch (to be ported)

Thanks for the explanation in that review xjm. :) This is committed to 8.x.

REMINDER to file that follow-up issue on assertTrue vs assert() mentioned in #2.

jhodgdon’s picture

Assigned: jhodgdon » Unassigned
dcam’s picture

Status: Patch (to be ported) » Needs review
StatusFileSize
new3.34 KB

Backported #1 to D7.

Status: Needs review » Needs work

The last submitted patch, xmlrpc-1798390-5.patch, failed testing.

dcam’s picture

Status: Needs work » Needs review
StatusFileSize
new3.21 KB

Oops, deleted an extra ')'. It's strange that it passed the tests locally.

dcam’s picture

#7: xmlrpc-1798390-7.patch queued for re-testing.

dcam’s picture

Issue tags: +Novice

Tagging as Novice.

izus’s picture

#7: xmlrpc-1798390-7.patch queued for re-testing.

izus’s picture

Status: Needs review » Reviewed & tested by the community

hi,
the patch seems good :)

Thanks

dcam’s picture

Thanks for the review, izus!

jhodgdon’s picture

Status: Reviewed & tested by the community » Fixed

Thanks all! Committed to 7.x. Another one bites the dust!

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

Anonymous’s picture

Issue summary: View changes

Added count numbers.