diff --git a/payment/uc_credit/src/Tests/CreditCardTest.php b/payment/uc_credit/src/Tests/CreditCardTest.php
index 8ad250f..b254e9f 100644
--- a/payment/uc_credit/src/Tests/CreditCardTest.php
+++ b/payment/uc_credit/src/Tests/CreditCardTest.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\uc_credit\Tests;
 
+use Drupal\Component\Utility\SafeMarkup;
 use Drupal\uc_store\Tests\UbercartTestBase;
 
 /**
@@ -274,10 +275,10 @@ class CreditCardTest extends UbercartTestBase {
         $this->drupalPostForm('admin/store/orders/' . $order->id() . '/credit', $edit, 'Charge amount');
 
         if ($y > $year || $m >= $month) {
-          $this->assertText('The credit card was processed successfully.', t('Card with expiry date @month/@year passed validation.', array('@month' => $m, '@year' => $y)));
+          $this->assertText('The credit card was processed successfully.', SafeMarkup::format('Card with expiry date @month/@year passed validation.', ['@month' => $m, '@year' => $y]));
         }
         else {
-          $this->assertNoText('The credit card was processed successfully.', t('Card with expiry date @month/@year correctly failed validation.', array('@month' => $m, '@year' => $y)));
+          $this->assertNoText('The credit card was processed successfully.', SafeMarkup::format('Card with expiry date @month/@year correctly failed validation.', ['@month' => $m, '@year' => $y]));
         }
       }
     }
diff --git a/uc_cart_links/src/Tests/CartLinksTest.php b/uc_cart_links/src/Tests/CartLinksTest.php
index 9655b28..c71308a 100644
--- a/uc_cart_links/src/Tests/CartLinksTest.php
+++ b/uc_cart_links/src/Tests/CartLinksTest.php
@@ -8,6 +8,7 @@
 namespace Drupal\uc_cart_links\Tests;
 
 use Drupal\Core\Url;
+use Drupal\Component\Utility\SafeMarkup;
 use Drupal\uc_store\Tests\UbercartTestBase;
 
 /**
@@ -131,12 +132,12 @@ class CartLinksTest extends UbercartTestBase {
       $this->assertLink(
         t('Cart Link #@link', ['@link' => $key]),
         0,
-        format_string('Cart Link #@link found on page.', ['@link' => $key])
+        SafeMarkup::format('Cart Link #@link found on page.', ['@link' => $key])
       );
       $this->assertLinkByHref(
         t('@link', ['@link' => $test_link]),
         0,
-        format_string('Cart Link @link found on page.', ['@link' => $test_link])
+        SafeMarkup::format('Cart Link @link found on page.', ['@link' => $test_link])
       );
 
       // Click on link
@@ -145,7 +146,7 @@ class CartLinksTest extends UbercartTestBase {
       // by default, see admin/store/config/cart)
       $this->assertText(
         t('@title added to your shopping cart.', ['@title' => $link_data[$key]['title']]),
-        format_string('Product @title added to cart.', ['@title' => $link_data[$key]['title']])
+        SafeMarkup::format('Product @title added to cart.', ['@title' => $link_data[$key]['title']])
       );
 
       // Check contents of cart
@@ -164,13 +165,13 @@ class CartLinksTest extends UbercartTestBase {
       foreach ($link_data[$key]['attributes'] as $label => $attribute) {
         $this->assertText(
           $label . ':',
-          format_string('Attribute @label correct in cart.', ['@label' => $label])
+          SafeMarkup::format('Attribute @label correct in cart.', ['@label' => $label])
         );
         foreach ($attribute as $option) {
           // Check for correct option name(s) in cart
           $this->assertText(
             $option,
-            format_string('Option @name correct in cart.', ['@name' => $option])
+            SafeMarkup::format('Option @name correct in cart.', ['@name' => $option])
           );
         }
       }
@@ -181,7 +182,7 @@ class CartLinksTest extends UbercartTestBase {
       // Default add-to-cart message is different when adding a duplicate item
       $this->assertNoText(
         t('Your item(s) have been updated.'),
-        format_string('Default add-to-cart message suppressed.')
+        SafeMarkup::format('Default add-to-cart message suppressed.')
       );
 
       // Empty cart (press remove button)
@@ -360,7 +361,7 @@ class CartLinksTest extends UbercartTestBase {
     // by default, see admin/store/config/cart)
     $this->assertText(
       t('@title added to your shopping cart.', ['@title' => $link_data[$test_link_0]['title']]),
-      format_string('Product @title added to cart.', ['@title' => $link_data[$test_link_0]['title']])
+      SafeMarkup::format('Product @title added to cart.', ['@title' => $link_data[$test_link_0]['title']])
     );
 
     // Pick another link at random, as long as it is different from first
@@ -408,7 +409,7 @@ class CartLinksTest extends UbercartTestBase {
     $this->clickLink(t('Cart Link #@link', ['@link' => $test_link]));
     $this->assertText(
       t('@title added to your shopping cart.', ['@title' => $link_data[$test_link]['title']]),
-      format_string('Product @title added to cart.', ['@title' => $link_data[$test_link]['title']])
+      SafeMarkup::format('Product @title added to cart.', ['@title' => $link_data[$test_link]['title']])
     );
 
     $this->drupalLogout();
@@ -458,7 +459,7 @@ class CartLinksTest extends UbercartTestBase {
     $this->drupalGet($cart_links[$test_link] . '-m' . $message_key);
     $this->assertText(
       t('@message', ['@message' => $message_text[1]]),
-      format_string('Message @key displayed.', ['@key' => $message_key])
+      SafeMarkup::format('Message @key displayed.', ['@key' => $message_key])
     );
 
     // Empty cart (press remove button)
@@ -525,7 +526,7 @@ class CartLinksTest extends UbercartTestBase {
 //    $result = $this->xpath('//tbody/tr/td[contains(concat(" ", @class, " "), " views-field-clicks ")]');
       $this->assertTextPattern(
         '/\s+' . preg_quote($id, '/') . '\s+' . preg_quote($clicks, '/') . '\s+/',
-        format_string('Tracking ID @id received @clicks clicks.', ['@id' => $id, '@clicks' => $clicks])
+        SafeMarkup::format('Tracking ID @id received @clicks clicks.', ['@id' => $id, '@clicks' => $clicks])
       );
     }
     $this->assertEqual($total, 50, 'Fifty clicks recorded.');
@@ -555,7 +556,7 @@ class CartLinksTest extends UbercartTestBase {
     $this->assertFieldByName(
       'uc_cart_links_add_show',
       $state,
-      format_string('Display Cart Links product action messages is @state.', ['@state' => $state ? 'TRUE' : 'FALSE'])
+      SafeMarkup::format('Display Cart Links product action messages is @state.', ['@state' => $state ? 'TRUE' : 'FALSE'])
     );
   }
 
@@ -577,7 +578,7 @@ class CartLinksTest extends UbercartTestBase {
     $this->assertFieldByName(
       'uc_cart_links_track',
       $state ? 1 : 0,
-      format_string('Track clicks is @state.', ['@state' => $state ? 'TRUE' : 'FALSE'])
+      SafeMarkup::format('Track clicks is @state.', ['@state' => $state ? 'TRUE' : 'FALSE'])
     );
   }
 
@@ -599,7 +600,7 @@ class CartLinksTest extends UbercartTestBase {
     $this->assertFieldByName(
       'uc_cart_links_empty',
       $state,
-      format_string('Allow Cart Links to empty carts is @state.', ['@state' => $state ? 'TRUE' : 'FALSE'])
+      SafeMarkup::format('Allow Cart Links to empty carts is @state.', ['@state' => $state ? 'TRUE' : 'FALSE'])
     );
   }
 
@@ -622,7 +623,7 @@ class CartLinksTest extends UbercartTestBase {
     $this->assertFieldByName(
       'uc_cart_links_messages',
       $message_string,
-      format_string('Cart Links messages contains "@messages".', ['@messages' => $message_string])
+      SafeMarkup::format('Cart Links messages contains "@messages".', ['@messages' => $message_string])
     );
   }
 
@@ -644,7 +645,7 @@ class CartLinksTest extends UbercartTestBase {
     $this->assertFieldByName(
       'uc_cart_links_restrictions',
       $restrictions,
-      format_string('Cart Links restrictions contains "@restrictions".', ['@restrictions' => $restrictions])
+      SafeMarkup::format('Cart Links restrictions contains "@restrictions".', ['@restrictions' => $restrictions])
     );
   }
 
@@ -665,7 +666,7 @@ class CartLinksTest extends UbercartTestBase {
     $this->assertFieldByName(
       'uc_cart_links_invalid_page',
       $url,
-      format_string('Cart Links invalid page URL contains "@url".', ['@url' => $url])
+      SafeMarkup::format('Cart Links invalid page URL contains "@url".', ['@url' => $url])
     );
   }
 
diff --git a/uc_country/src/Tests/CountryTest.php b/uc_country/src/Tests/CountryTest.php
index d1f86aa..e25e036 100644
--- a/uc_country/src/Tests/CountryTest.php
+++ b/uc_country/src/Tests/CountryTest.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\uc_country\Tests;
 
+use Drupal\Component\Utility\SafeMarkup;
 use Drupal\simpletest\WebTestBase;
 
 /**
@@ -37,7 +38,7 @@ class CountryTest extends WebTestBase {
       $this->assertLinkByHref(
         'admin/store/config/country/' . $country_id . '/enable',
         0,
-        format_string('%country is not enabled by default.', ['%country' => $countries[$country_id]])
+        SafeMarkup::format('%country is not enabled by default.', ['%country' => $countries[$country_id]])
       );
 
       // Enable this country.
@@ -46,7 +47,7 @@ class CountryTest extends WebTestBase {
       $this->assertLinkByHref(
         'admin/store/config/country/' . $country_id . '/disable',
         0,
-        format_string('%country is now enabled.', ['%country' => $countries[$country_id]])
+        SafeMarkup::format('%country is now enabled.', ['%country' => $countries[$country_id]])
       );
     }
 
@@ -55,7 +56,7 @@ class CountryTest extends WebTestBase {
     $this->assertNoOption(
       'edit-uc-store-country',
       $last_country,
-      format_string('%country not listed in uc_address select country field.', ['%country' => $countries[$last_country]])
+      SafeMarkup::format('%country not listed in uc_address select country field.', ['%country' => $countries[$last_country]])
     );
 
     // Enable the last country.
@@ -64,7 +65,7 @@ class CountryTest extends WebTestBase {
     $this->assertLinkByHref(
       'admin/store/config/country/' . $last_country . '/disable',
       0,
-      format_string('%country is now enabled.', ['%country' => $countries[$last_country]])
+      SafeMarkup::format('%country is now enabled.', ['%country' => $countries[$last_country]])
     );
 
     // Verify that last random country now shows up as available.
@@ -72,7 +73,7 @@ class CountryTest extends WebTestBase {
     $this->assertOption(
       'edit-uc-store-country',
       $last_country,
-      format_string('%country is listed in uc_address select country field.', ['%country' => $countries[$last_country]])
+      SafeMarkup::format('%country is listed in uc_address select country field.', ['%country' => $countries[$last_country]])
     );
 
     // Disable the last country using the operations button.
@@ -82,7 +83,7 @@ class CountryTest extends WebTestBase {
     $this->assertLinkByHref(
       'admin/store/config/country/' . $last_country . '/enable',
       0,
-      format_string('%country is now disabled.', ['%country' => $countries[$last_country]])
+      SafeMarkup::format('%country is now disabled.', ['%country' => $countries[$last_country]])
     );
   }
 
diff --git a/uc_order/src/Tests/OrderTest.php b/uc_order/src/Tests/OrderTest.php
index 3df178a..91628b4 100644
--- a/uc_order/src/Tests/OrderTest.php
+++ b/uc_order/src/Tests/OrderTest.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\uc_order\Tests;
 
+use Drupal\Component\Utility\SafeMarkup;
 use Drupal\Component\Utility\Unicode;
 use Drupal\uc_order\Entity\Order;
 use Drupal\uc_store\Address;
@@ -123,7 +124,7 @@ class OrderTest extends UbercartTestBase {
       ->condition('uid', $this->customer->id())
       ->execute();
     $order_id = reset($order_ids);
-    $this->assertTrue($order_id, t('Found order ID @order_id', ['@order_id' => $order_id]));
+    $this->assertTrue($order_id, SafeMarkup::format('Found order ID @order_id', ['@order_id' => $order_id]));
 
     $this->drupalGet('admin/store/orders/view');
     $this->assertLinkByHref('admin/store/orders/' . $order_id, 0, 'View link appears on order list.');
@@ -269,7 +270,7 @@ class OrderTest extends UbercartTestBase {
     $order_ids = \Drupal::entityQuery('uc_order')
       ->condition('order_id', $order->id())
       ->execute();
-    $this->assertTrue(in_array($order->id(), $order_ids), t('Found order ID @order_id', ['@order_id' => $order->id()]));
+    $this->assertTrue(in_array($order->id(), $order_ids), SafeMarkup::format('Found order ID @order_id', ['@order_id' => $order->id()]));
 
     $country_manager = \Drupal::service('country_manager');
     $country = array_rand($country_manager->getEnabledList());
diff --git a/uc_tax/src/Tests/StoredTaxTest.php b/uc_tax/src/Tests/StoredTaxTest.php
index c50c9f1..2649faa 100644
--- a/uc_tax/src/Tests/StoredTaxTest.php
+++ b/uc_tax/src/Tests/StoredTaxTest.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\uc_tax\Tests;
 
+use Drupal\Component\Utility\SafeMarkup;
 use Drupal\uc_store\Tests\UbercartTestBase;
 
 /**
@@ -90,7 +91,7 @@ class StoredTaxTest extends UbercartTestBase {
     $order_id = reset($order_ids);
     if ($order_id) {
       $this->pass(
-        t('Order %order_id has been created', ['%order_id' => $order_id])
+        SafeMarkup::format('Order %order_id has been created', ['%order_id' => $order_id])
       );
 
       $this->drupalGet('admin/store/orders/' . $order_id . '/edit');
