diff --git a/src/Tests/SchedulerPastDatesTest.php b/src/Tests/SchedulerPastDatesTest.php
index 80dc84f..5d470a5 100644
--- a/src/Tests/SchedulerPastDatesTest.php
+++ b/src/Tests/SchedulerPastDatesTest.php
@@ -50,8 +50,8 @@ class SchedulerPastDatesTest extends SchedulerTestBase {
     // Test the 'publish' behavior: the node should be published immediately.
     $this->nodetype->setThirdPartySetting('scheduler', 'publish_past_date', 'publish')->save();
     $this->drupalPostForm('node/' . $node->id() . '/edit', $edit, t('Save and publish'));
-    $this->assertNoRaw(t("The 'publish on' date must be in the future"), 'No error message is shown when the publication date is in the past and the "publish" behavior is chosen.');
-    $this->assertRaw(t('@type %title has been updated.', ['@type' => t('Basic page'), '%title' => SafeMarkup::checkPlain($edit['title[0][value]'])]), 'The node is saved successfully when the publication date is in the past and the "publish" behavior is chosen.');
+    $this->assertNoText(t("The 'publish on' date must be in the future"), 'No error message is shown when the publication date is in the past and the "publish" behavior is chosen.');
+    $this->assertText(sprintf('%s %s has been updated.', $this->nodetype->get('name'), SafeMarkup::checkPlain($edit['title[0][value]'])), 'The node is saved successfully when the publication date is in the past and the "publish" behavior is chosen.');
 
     // Reload the changed node and check that it is published.
     $node_storage->resetCache([$node->id()]);
@@ -66,9 +66,9 @@ class SchedulerPastDatesTest extends SchedulerTestBase {
     $this->nodetype->setThirdPartySetting('scheduler', 'publish_past_date', 'schedule')->save();
     $this->drupalPostForm('node/' . $node->id() . '/edit', $edit, t('Save and keep published'));
     $publish_time = $edit['publish_on[0][value][date]'] . ' ' . $edit['publish_on[0][value][time]']; ### @TODO should use date format from config
-    $this->assertNoRaw(t("The 'publish on' date must be in the future"), 'No error message is shown when the publication date is in the past and the "schedule" behavior is chosen.');
-    $this->assertRaw(t('@type %title has been updated.', ['@type' => t('Basic page'), '%title' => SafeMarkup::checkPlain($edit['title[0][value]'])]), 'The node is saved successfully when the publication date is in the past and the "schedule" behavior is chosen.');
-    $this->assertRaw(t('This post is unpublished and will be published @publish_time.', ['@publish_time' => $publish_time]), 'The node is scheduled to be published when the publication date is in the past and the "schedule" behavior is chosen.');
+    $this->assertNoText(t("The 'publish on' date must be in the future"), 'No error message is shown when the publication date is in the past and the "schedule" behavior is chosen.');
+    $this->assertText(sprintf('%s %s has been updated.', $this->nodetype->get('name'), SafeMarkup::checkPlain($edit['title[0][value]'])), 'The node is saved successfully when the publication date is in the past and the "schedule" behavior is chosen.');
+    $this->assertText(t('This post is unpublished and will be published @publish_time.', ['@publish_time' => $publish_time]), 'The node is scheduled to be published when the publication date is in the past and the "schedule" behavior is chosen.');
 
     // Reload the node and check that it is unpublished but scheduled correctly.
     $node_storage->resetCache([$node->id()]);
diff --git a/src/Tests/SchedulerPermissionsTest.php b/src/Tests/SchedulerPermissionsTest.php
index 647ed17..e4314e7 100644
--- a/src/Tests/SchedulerPermissionsTest.php
+++ b/src/Tests/SchedulerPermissionsTest.php
@@ -6,6 +6,8 @@
 
 namespace Drupal\scheduler\Tests;
 
+use Drupal\Component\Utility\SafeMarkup;
+
 /**
  * Tests the permissions of the Scheduler module.
  *
@@ -43,12 +45,12 @@ class SchedulerPermissionsTest extends SchedulerTestBase {
     // Check that a new node can be saved and published.
     $title = $this->randomString(15);
     $this->drupalPostForm('node/add/' . $type, ['title[0][value]' => $title], t('Save and publish'));
-    $this->assertRaw(t('@type %title has been created.', array('@type' => $type, '%title' => $title)), 'A node can be created and published when the user does not have scheduler permissions.');
+    $this->assertText(sprintf('%s %s has been created.', $this->nodetype->get('name'), SafeMarkup::checkPlain($title)), 'A node can be created and published when the user does not have scheduler permissions.');
 
     // Check that a new node can be saved as unpublished.
     $title = $this->randomString(15);
     $this->drupalPostForm('node/add/' . $type, ['title[0][value]' => $title], t('Save as unpublished'));
-    $this->assertRaw(t('@type %title has been created.', array('@type' => $type, '%title' => $title)), 'A node can be created and saved as unpublished when the user does not have scheduler permissions.');
+    $this->assertText(sprintf('%s %s has been created.', $this->nodetype->get('name'), SafeMarkup::checkPlain($title)), 'A node can be created and saved as unpublished when the user does not have scheduler permissions.');
 
     // Set publishing and unpublishing to required, to make it a stronger test.
     $this->nodetype->setThirdPartySetting('scheduler', 'publish_required', TRUE)
diff --git a/src/Tests/SchedulerRequiredTest.php b/src/Tests/SchedulerRequiredTest.php
index 6f05907..e5b54b2 100644
--- a/src/Tests/SchedulerRequiredTest.php
+++ b/src/Tests/SchedulerRequiredTest.php
@@ -7,6 +7,7 @@
 namespace Drupal\scheduler\Tests;
 
 use Drupal\node\Entity\NodeType;
+use Drupal\Component\Utility\SafeMarkup;
 
 /**
  * Tests the options for scheduling dates to be required during add/edit.
@@ -216,16 +217,13 @@ class SchedulerRequiredTest extends SchedulerTestBase {
       // Check for the expected result.
       switch ($test_case['expected']) {
         case 'required':
-          $string = t('The %name date is required.', ['%name' => ucfirst($test_case['required']) . ' on']);
-          $this->assertRaw($string, $test_case['id'] . '. ' . $test_case['message']);
+          $string = sprintf('The %s date is required.', ucfirst($test_case['required']) . ' on');
+          $this->assertText($string, $test_case['id'] . '. ' . $test_case['message']);
           break;
 
         case 'not required':
-          $string = '@type %title has been ' . ($test_case['operation'] == 'add' ? 'created' : 'updated') . '.';
-          $args = ['@type' => 'Basic page', '%title' => $title];
-          // @codingStandardsIgnoreStart
-          $this->assertRaw(t($string, $args), $test_case['id'] . '. ' . $test_case['message']);
-          // @codingStandardsIgnoreEnd
+          $string = sprintf('%s %s has been %s.', 'Basic page', SafeMarkup::checkPlain($title), ($test_case['operation'] == 'add' ? 'created' : 'updated'));
+          $this->assertText($string, $test_case['id'] . '. ' . $test_case['message']);
           break;
       }
     }
