diff --git a/core/modules/block_content/tests/src/Functional/BlockContentTranslationUITest.php b/core/modules/block_content/tests/src/Functional/BlockContentTranslationUITest.php
index 2699fcfb69..f0a91fe462 100644
--- a/core/modules/block_content/tests/src/Functional/BlockContentTranslationUITest.php
+++ b/core/modules/block_content/tests/src/Functional/BlockContentTranslationUITest.php
@@ -4,8 +4,9 @@
 
 use Drupal\block_content\Entity\BlockContent;
 use Drupal\block_content\Entity\BlockContentType;
+use Drupal\Component\Render\FormattableMarkup;
 use Drupal\Component\Utility\Unicode;
-use Drupal\content_translation\Tests\ContentTranslationUITestBase;
+use Drupal\Tests\content_translation\Functional\ContentTranslationUITestBase;
 
 /**
  * Tests the block content translation UI.
@@ -192,12 +193,12 @@ protected function doTestTranslationEdit() {
         $url = $entity->urlInfo('edit-form', $options);
         $this->drupalGet($url);
 
-        $title = t('<em>Edit @type</em> @title [%language translation]', [
+        $title = new FormattableMarkup('<em>Edit @type</em> @title [%language translation]', [
           '@type' => $entity->bundle(),
           '@title' => $entity->getTranslation($langcode)->label(),
           '%language' => $languages[$langcode]->getName(),
         ]);
-        $this->assertRaw($title);
+        $this->assertRaw((string) $title);
       }
     }
   }
diff --git a/core/modules/shortcut/tests/src/Functional/ShortcutTranslationUITest.php b/core/modules/shortcut/tests/src/Functional/ShortcutTranslationUITest.php
index 83bf47a495..6afd1d6012 100644
--- a/core/modules/shortcut/tests/src/Functional/ShortcutTranslationUITest.php
+++ b/core/modules/shortcut/tests/src/Functional/ShortcutTranslationUITest.php
@@ -2,9 +2,10 @@
 
 namespace Drupal\Tests\shortcut\Functional;
 
-use Drupal\content_translation\Tests\ContentTranslationUITestBase;
+use Drupal\Component\Render\FormattableMarkup;
 use Drupal\Core\Entity\EntityChangedInterface;
 use Drupal\Core\Language\Language;
+use Drupal\Tests\content_translation\Functional\ContentTranslationUITestBase;
 
 /**
  * Tests the shortcut translation UI.
@@ -100,11 +101,11 @@ protected function doTestTranslationEdit() {
         $url = $entity->urlInfo('edit-form', $options);
         $this->drupalGet($url);
 
-        $title = t('@title [%language translation]', [
+        $title = new FormattableMarkup('@title [%language translation]', [
           '@title' => $entity->getTranslation($langcode)->label(),
           '%language' => $languages[$langcode]->getName(),
         ]);
-        $this->assertRaw($title);
+        $this->assertRaw((string) $title);
       }
     }
   }
