format_string() was obsoleted more than a year ago (see New SafeMarkup and HTML utility components replace check_plain(), format_string(), drupal_placeholder()), and is now officially deprecated (#2221771: Mark all simple wrappers in bootstrap.inc and common.inc as deprecated)

The attached patch changes the SimpleTest documentation comments to reflect that code should now use SafeMarkup::format() instead of format_string() in assert messages.

The patch changes this boilerplate documentation on 43 functions:

    * @param $message
    *   (optional) A message to display with the assertion. Do not translate
-   *   messages: use format_string() to embed variables in the message text, not
-   *   t(). If left blank, a default message will be displayed.
+   *   messages: use \Drupal\Component\Utility\SafeMarkup::format() to embed
+   *   variables in the message text, not t(). If left blank, a default message
+   *   will be displayed.
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

TR created an issue. See original summary.

TR’s picture

Status: Active » Needs review
TR’s picture

core/modules/views/src/Tests/Handler/FieldKernelTest.php also uses the same boilerplate documentation. This new patch fixes that as well.

jhodgdon’s picture

Status: Needs review » Reviewed & tested by the community

Looks good, thanks!

webchick’s picture

Assigned: Unassigned » alexpott

Actually, I'm not sure whether even SafeMarkup::format() is long for this world anymore with the stuff happening in #2549943: [plan] Remove as much of the SafeMarkup class's methods as possible. Shooting over to @alexpott.

jhodgdon’s picture

We need to have *some* way to do "Insert some variables into text" I think?

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed c5dbd43 and pushed to 8.0.x. Thanks!

  • alexpott committed c5dbd43 on 8.0.x
    Issue #2555169 by TR: API documentation should not suggest using...

Status: Fixed » Closed (fixed)

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