diff -u b/core/modules/user/tests/modules/user_hooks_test/user_hooks_test.module b/core/modules/user/tests/modules/user_hooks_test/user_hooks_test.module --- b/core/modules/user/tests/modules/user_hooks_test/user_hooks_test.module +++ b/core/modules/user/tests/modules/user_hooks_test/user_hooks_test.module @@ -5,6 +5,8 @@ * Support module for user hooks testing. */ +use Drupal\Core\Render\SafeString; + /** * Implements hook_user_format_name_alter(). */ @@ -12,7 +14,9 @@ if (\Drupal::state()->get('user_hooks_test_user_format_name_alter', FALSE)) { if (\Drupal::state()->get('user_hooks_test_user_format_name_alter_safe', FALSE)) { // Make $name a SafeStringInterface object. - $name = t('@id', ['@id' => $account->id()]); + // @todo change this to SafeMarkup::format() after + // https://www.drupal.org/node/2559971 lands. + $name = new SafeString('@id', ['@id' => $account->id()]); } else { $name = '' . $account->id() . '';