diff --git a/modules/simplenews_demo/src/Plugin/simplenews/RecipientHandler/RecipientHandlerSubscribersByRole.php b/modules/simplenews_demo/src/Plugin/simplenews/RecipientHandler/RecipientHandlerSubscribersByRole.php
index abd118f..db8ae4c 100644
--- a/modules/simplenews_demo/src/Plugin/simplenews/RecipientHandler/RecipientHandlerSubscribersByRole.php
+++ b/modules/simplenews_demo/src/Plugin/simplenews/RecipientHandler/RecipientHandlerSubscribersByRole.php
@@ -23,7 +23,7 @@ class RecipientHandlerSubscribersByRole extends RecipientHandlerEntityBase {
 
     $element['role'] = [
       '#type' => 'select',
-      '#title' => t('Role'),
+      '#title' => $this->t('Role'),
       '#default_value' => $this->configuration['role'] ?? NULL,
       '#options' => $roles,
     ];
diff --git a/modules/simplenews_demo/tests/src/Functional/SimplenewsDemoTest.php b/modules/simplenews_demo/tests/src/Functional/SimplenewsDemoTest.php
index e75afc2..2be8689 100644
--- a/modules/simplenews_demo/tests/src/Functional/SimplenewsDemoTest.php
+++ b/modules/simplenews_demo/tests/src/Functional/SimplenewsDemoTest.php
@@ -51,7 +51,7 @@ class SimplenewsDemoTest extends BrowserTestBase {
     $this->assertText('Stay informed - subscribe to our newsletter.');
 
     $this->drupalGet('admin/config/services/simplenews');
-    $this->clickLink(t('Edit'));
+    $this->clickLink($this->t('Edit'));
     // Assert default description is present.
     $this->assertEquals('This is an example newsletter. Change it.', $this->xpath('//textarea[@id="edit-description"]')[0]->getText());
     $from_name = $this->xpath('//input[@id="edit-from-name"]')[0];
@@ -60,9 +60,9 @@ class SimplenewsDemoTest extends BrowserTestBase {
     $this->assertEquals('simpletest@example.com', (string) $from_address->getValue());
     // Assert demo newsletters.
     $this->drupalGet('admin/config/services/simplenews');
-    $this->assertText(t('Press releases'));
-    $this->assertText(t('Special offers'));
-    $this->assertText(t('Weekly content update'));
+    $this->assertText($this->t('Press releases'));
+    $this->assertText($this->t('Special offers'));
+    $this->assertText($this->t('Weekly content update'));
     // Assert demo newsletters sent.
     $this->drupalGet('admin/content/simplenews');
     // @codingStandardsIgnoreLine
@@ -73,11 +73,11 @@ class SimplenewsDemoTest extends BrowserTestBase {
     $this->assertText('Stopped special offers');
     // @codingStandardsIgnoreLine
     //$this->assertText('Scheduled weekly content newsletter issue - Week ');
-    $this->assertRaw(t('Newsletter issue sent to 2 subscribers, 0 errors.'));
-    $this->assertRaw(t('Newsletter issue is pending, 0 mails sent out of 3, 0 errors.'));
+    $this->assertRaw($this->t('Newsletter issue sent to 2 subscribers, 0 errors.'));
+    $this->assertRaw($this->t('Newsletter issue is pending, 0 mails sent out of 3, 0 errors.'));
     // Weekly newsletter.
     // @codingStandardsIgnoreLine
-    //$this->assertRaw(t('Newsletter issue sent to 1 subscribers, 0 errors.'));
+    //$this->assertRaw($this->t('Newsletter issue sent to 1 subscribers, 0 errors.'));
     // Assert demo subscribers.
     $this->drupalGet('admin/people/simplenews');
     $this->assertText('a@example.com');
diff --git a/src/Mail/Mailer.php b/src/Mail/Mailer.php
index 44b850b..1643d4e 100644
--- a/src/Mail/Mailer.php
+++ b/src/Mail/Mailer.php
@@ -49,7 +49,7 @@ class Mailer implements MailerInterface {
    */
   const TRACK_RESULTS = [
     SpoolStorageInterface::STATUS_DONE => TRUE,
-    SpoolStorageInterface::STATUS_FAILED =>TRUE
+    SpoolStorageInterface::STATUS_FAILED => TRUE,
   ];
 
   /**
diff --git a/src/Plugin/migrate/source/d7/Issue.php b/src/Plugin/migrate/source/d7/Issue.php
index 52e7567..ae48a36 100644
--- a/src/Plugin/migrate/source/d7/Issue.php
+++ b/src/Plugin/migrate/source/d7/Issue.php
@@ -2,7 +2,6 @@
 
 namespace Drupal\simplenews\Plugin\migrate\source\d7;
 
-use Drupal\migrate\Row;
 use Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase;
 
 /**
diff --git a/tests/modules/simplenews_test/simplenews_test.module b/tests/modules/simplenews_test/simplenews_test.module
index 850e24f..241995f 100644
--- a/tests/modules/simplenews_test/simplenews_test.module
+++ b/tests/modules/simplenews_test/simplenews_test.module
@@ -5,7 +5,6 @@
  * Hook implementations for the Simplenews Test module.
  */
 
-use Drupal\simplenews\Mail\MailInterface;
 use Drupal\simplenews\AbortSendingException;
 use Drupal\simplenews\SkipMailException;
 
diff --git a/tests/src/Functional/SimplenewsAdministrationTest.php b/tests/src/Functional/SimplenewsAdministrationTest.php
index 72c453b..780b66b 100644
--- a/tests/src/Functional/SimplenewsAdministrationTest.php
+++ b/tests/src/Functional/SimplenewsAdministrationTest.php
@@ -40,6 +40,8 @@ class SimplenewsAdministrationTest extends SimplenewsTestBase {
 
   /**
    * Test various combinations of newsletter settings.
+   *
+   * @throws \Drupal\Core\Entity\EntityStorageException
    */
   public function testNewsletterSettings() {
 
@@ -71,7 +73,7 @@ class SimplenewsAdministrationTest extends SimplenewsTestBase {
 
     foreach ($new_account as $new_account_setting) {
       foreach ($opt_inout as $opt_inout_setting) {
-        $this->clickLink(t('Add newsletter'));
+        $this->clickLink($this->t('Add newsletter'));
         $edit = [
           'name' => implode('-', [$new_account_setting, $opt_inout_setting]),
           'id' => implode('_', [$new_account_setting, $opt_inout_setting]),
@@ -83,12 +85,12 @@ class SimplenewsAdministrationTest extends SimplenewsTestBase {
           'from_name' => $this->randomMachineName(),
           'from_address' => $this->randomEmail(),
         ];
-        $this->drupalPostForm(NULL, $edit, t('Save'));
+        $this->drupalPostForm(NULL, $edit, $this->t('Save'));
       }
     }
 
     // New title should be saved correctly.
-    $this->drupalPostForm('admin/config/services/simplenews/manage/default', ['subject' => 'Edited subject'], t('Save'));
+    $this->drupalPostForm('admin/config/services/simplenews/manage/default', ['subject' => 'Edited subject'], $this->t('Save'));
     $this->drupalGet('admin/config/services/simplenews/manage/default');
     $this->assertFieldByName('subject', 'Edited subject');
 
@@ -115,7 +117,7 @@ class SimplenewsAdministrationTest extends SimplenewsTestBase {
         $this->assertNoFieldChecked($this->getNewsletterFieldId($newsletter->id()));
       }
       else {
-        $this->assertNoField('subscriptions[' . $newsletter->id() . ']', t('Hidden or silent newsletter is not shown.'));
+        $this->assertNoField('subscriptions[' . $newsletter->id() . ']', $this->t('Hidden or silent newsletter is not shown.'));
       }
     }
 
@@ -128,20 +130,20 @@ class SimplenewsAdministrationTest extends SimplenewsTestBase {
       'pass[pass2]' => $pass,
       'subscriptions[' . $off_double_newsletter_id . ']' => $off_double_newsletter_id,
     ];
-    $this->drupalPostForm(NULL, $edit, t('Create new account'));
+    $this->drupalPostForm(NULL, $edit, $this->t('Create new account'));
 
     // Verify confirmation messages.
-    $this->assertText(t('Registration successful. You are now logged in.'));
+    $this->assertText($this->t('Registration successful. You are now logged in.'));
     foreach ($newsletters as $newsletter) {
       // Check confirmation message for all on and non-hidden newsletters and
       // the one that was explicitly selected.
       if (($newsletter->new_account == 'on' && $newsletter->opt_inout != 'hidden') || $newsletter->name == 'off-double') {
-        $this->assertText(t('You have been subscribed to @name.', ['@name' => $newsletter->name]));
+        $this->assertText($this->t('You have been subscribed to @name.', ['@name' => $newsletter->name]));
       }
       else {
         // All other newsletters must not show a message, e.g. those which were
         // subscribed silently.
-        $this->assertNoText(t('You have been subscribed to @name.', ['@name' => $newsletter->name]));
+        $this->assertNoText($this->t('You have been subscribed to @name.', ['@name' => $newsletter->name]));
       }
     }
 
@@ -162,7 +164,7 @@ class SimplenewsAdministrationTest extends SimplenewsTestBase {
         }
         list($new_account_setting, $opt_inout_setting) = explode('-', $newsletter->name);
         if ($newsletter->opt_inout == 'hidden') {
-          $this->assertNoField('subscriptions[' . $newsletter->id() . ']', t('Hidden newsletter is not shown.'));
+          $this->assertNoField('subscriptions[' . $newsletter->id() . ']', $this->t('Hidden newsletter is not shown.'));
         }
         elseif ($newsletter->new_account == 'on' || $newsletter->name == 'off-double' || $newsletter->new_account == 'silent') {
           // All on, silent and the explicitly selected newsletter should be
@@ -179,7 +181,7 @@ class SimplenewsAdministrationTest extends SimplenewsTestBase {
     $edit = [
       'subscriptions[' . $off_double_newsletter_id . ']' => FALSE,
     ];
-    $this->drupalPostForm(NULL, $edit, t('Save'));
+    $this->drupalPostForm(NULL, $edit, $this->t('Save'));
     $this->drupalGet('user/' . $user->id() . '/simplenews');
     $this->assertNoFieldChecked($this->getNewsletterFieldId($off_double_newsletter_id));
 
@@ -201,7 +203,7 @@ class SimplenewsAdministrationTest extends SimplenewsTestBase {
     $this->drupalGet('admin/people/simplenews/edit/' . $subscriber->id());
     $this->assertNoField($this->getNewsletterFieldId('on_hidden'));
     $this->assertNoField('mail');
-    $this->drupalPostForm('admin/people/simplenews/edit/' . $subscriber->id(), [], t('Save'));
+    $this->drupalPostForm('admin/people/simplenews/edit/' . $subscriber->id(), [], $this->t('Save'));
     $this->drupalGet('admin/people/simplenews/edit/' . $subscriber->id());
     $this->assertTrue($subscriber->isSubscribed('on_hidden'));
     $this->assertTrue($subscriber->isUnsubscribed($off_double_newsletter_id));
@@ -225,13 +227,13 @@ class SimplenewsAdministrationTest extends SimplenewsTestBase {
         'date' => date('c', strtotime('+' . $index . ' day', $date)),
       );
       $this->drupalPostForm(NULL, $edit, ('Save'));
-      $this->clickLink(t('Newsletter'));
-      $this->drupalPostForm(NULL, array('simplenews[send]' => SIMPLENEWS_COMMAND_SEND_NOW), t('Submit'));
+      $this->clickLink($this->t('Newsletter'));
+      $this->drupalPostForm(NULL, array('simplenews[send]' => SIMPLENEWS_COMMAND_SEND_NOW), $this->t('Submit'));
     }
 
     // Display the two recent issues.
     $this->drupalGet('');
-    $this->assertText(t('Previous issues'), 'Should display recent issues.');
+    $this->assertText($this->t('Previous issues'), 'Should display recent issues.');
 
     $displayed_issues = $this->xpath("//div[@class='issues-list']/div/ul/li/a");
 
@@ -242,23 +244,23 @@ class SimplenewsAdministrationTest extends SimplenewsTestBase {
     $this->assertTrue(in_array($generated_names[2], $displayed_issues));
 
     $this->drupalGet('admin/config/services/simplenews/manage/' . $edit_newsletter->id());
-    $this->assertFieldByName('name', $edit_newsletter->name, t('Newsletter name is displayed when editing'));
-    $this->assertFieldByName('description', $edit_newsletter->description, t('Newsletter description is displayed when editing'));
+    $this->assertFieldByName('name', $edit_newsletter->name, $this->t('Newsletter name is displayed when editing'));
+    $this->assertFieldByName('description', $edit_newsletter->description, $this->t('Newsletter description is displayed when editing'));
 
     $edit = array('block' => FALSE);
-    $this->drupalPostForm(NULL, $edit, t('Save'));
+    $this->drupalPostForm(NULL, $edit, $this->t('Save'));
 
     \Drupal::entityTypeManager()->getStorage('simplenews_newsletter')->resetCache();
     $updated_newsletter = Newsletter::load($edit_newsletter->newsletter_id);
-    $this->assertEqual(0, $updated_newsletter->block, t('Block for newsletter disabled'));
+    $this->assertEqual(0, $updated_newsletter->block, $this->t('Block for newsletter disabled'));
 
     $this->drupalGet('admin/structure/block');
-    $this->assertNoText($edit_newsletter->name, t('Newsletter block was removed'));
+    $this->assertNoText($edit_newsletter->name, $this->t('Newsletter block was removed'));
 
     // Delete a newsletter.
     $this->drupalGet('admin/config/services/simplenews/manage/' . $edit_newsletter->id());
-    $this->clickLink(t('Delete'));
-    $this->drupalPostForm(NULL, array(), t('Delete'));
+    $this->clickLink($this->t('Delete'));
+    $this->drupalPostForm(NULL, array(), $this->t('Delete'));
 
     // Verify that the newsletter has been deleted.
     \Drupal::entityTypeManager()->getStorage('simplenews_newsletter')->resetCache();
@@ -292,7 +294,7 @@ class SimplenewsAdministrationTest extends SimplenewsTestBase {
       'name' => $newsletter_name,
       'id'  => $newsletter_name,
     ];
-    $this->drupalPostForm('admin/config/services/simplenews/add', $edit, t('Save'));
+    $this->drupalPostForm('admin/config/services/simplenews/add', $edit, $this->t('Save'));
 
     // This test adds a number of subscribers to each newsletter separately and
     // then adds another bunch to both. First step is to create some arrays
@@ -332,7 +334,7 @@ class SimplenewsAdministrationTest extends SimplenewsTestBase {
     $this->clickLink('Subscribers');
     $i = 0;
     foreach ($groups as $key => $group) {
-      $this->clickLink(t('Mass subscribe'));
+      $this->clickLink($this->t('Mass subscribe'));
       $edit = [
         // Implode with a different, supported delimiter for each group.
         'emails' => implode($delimiters[$i++], $subscribers[$key]),
@@ -340,7 +342,7 @@ class SimplenewsAdministrationTest extends SimplenewsTestBase {
       foreach ($group as $newsletter_id) {
         $edit['newsletters[' . $newsletter_id . ']'] = TRUE;
       }
-      $this->drupalPostForm(NULL, $edit, t('Subscribe'));
+      $this->drupalPostForm(NULL, $edit, $this->t('Subscribe'));
     }
 
     // Verify that all addresses are displayed in the table.
@@ -417,8 +419,8 @@ class SimplenewsAdministrationTest extends SimplenewsTestBase {
       'emails' => $first_mail . ', ' . $all_mail,
       'newsletters[' . $first . ']' => TRUE,
     ];
-    $this->clickLink(t('Mass unsubscribe'));
-    $this->drupalPostForm(NULL, $edit, t('Unsubscribe'));
+    $this->clickLink($this->t('Mass unsubscribe'));
+    $this->drupalPostForm(NULL, $edit, $this->t('Unsubscribe'));
 
     // The all mail is still displayed because it's still subscribed to the
     // second newsletter. Reload the page to get rid of the confirmation
@@ -433,19 +435,19 @@ class SimplenewsAdministrationTest extends SimplenewsTestBase {
     $this->assertNoText($all_mail);
 
     // Check exporting.
-    $this->clickLink(t('Export'));
-    $this->drupalPostForm(NULL, ['newsletters[' . $first . ']' => TRUE], t('Export'));
+    $this->clickLink($this->t('Export'));
+    $this->drupalPostForm(NULL, ['newsletters[' . $first . ']' => TRUE], $this->t('Export'));
     $export_field = $this->xpath($this->constructFieldXpath('name', 'emails'));
     $exported_mails = $export_field[0]->getText();
     foreach ($subscribers[$first] as $mail) {
-      $this->assertTrue(strpos($exported_mails, $mail) !== FALSE, t('Mail address exported correctly.'));
+      $this->assertTrue(strpos($exported_mails, $mail) !== FALSE, $this->t('Mail address exported correctly.'));
     }
     foreach ($subscribers['all'] as $mail) {
       if ($mail != $all_mail) {
-        $this->assertTrue(strpos($exported_mails, $mail) !== FALSE, t('Mail address exported correctly.'));
+        $this->assertTrue(strpos($exported_mails, $mail) !== FALSE, $this->t('Mail address exported correctly.'));
       }
       else {
-        $this->assertFalse(strpos($exported_mails, $mail), t('Unsubscribed mail address not exported.'));
+        $this->assertFalse(strpos($exported_mails, $mail), $this->t('Unsubscribed mail address not exported.'));
       }
     }
 
@@ -455,7 +457,7 @@ class SimplenewsAdministrationTest extends SimplenewsTestBase {
       'subscribed[unsubscribed]' => TRUE,
       'newsletters[' . $first . ']' => TRUE,
     ];
-    $this->drupalPostForm(NULL, $edit, t('Export'));
+    $this->drupalPostForm(NULL, $edit, $this->t('Export'));
 
     $export_field = $this->xpath($this->constructFieldXpath('name', 'emails'));
     $exported_mails = $export_field[0]->getText();
@@ -484,7 +486,7 @@ class SimplenewsAdministrationTest extends SimplenewsTestBase {
       'subscribed[unsubscribed]' => FALSE,
       'newsletters[' . $first . ']' => TRUE,
     ];
-    $this->drupalPostForm(NULL, $edit, t('Export'));
+    $this->drupalPostForm(NULL, $edit, $this->t('Export'));
 
     $export_field = $this->xpath($this->constructFieldXpath('name', 'emails'));
     $exported_mails = $export_field[0]->getText();
@@ -499,7 +501,7 @@ class SimplenewsAdministrationTest extends SimplenewsTestBase {
       'subscribed[unsubscribed]' => FALSE,
       'newsletters[' . $first . ']' => TRUE,
     ];
-    $this->drupalPostForm(NULL, $edit, t('Export'));
+    $this->drupalPostForm(NULL, $edit, $this->t('Export'));
 
     $export_field = $this->xpath($this->constructFieldXpath('name', 'emails'));
     $exported_mails = $export_field[0]->getText();
@@ -528,7 +530,7 @@ class SimplenewsAdministrationTest extends SimplenewsTestBase {
     // Verify updated subscriptions count.
     drupal_static_reset('Drupal\simplenews\Plugin\simplenews\RecipientHandler\RecipientHandlerBase::count');
     $after_count = $spool_storage->issueCountRecipients($issue);
-    $this->assertEqual($before_count - 1, $after_count, t('Blocked users are not counted in subscription count.'));
+    $this->assertEqual($before_count - 1, $after_count, $this->t('Blocked users are not counted in subscription count.'));
 
     // Test mass subscribe with previously unsubscribed users.
     for ($i = 0; $i < 3; $i++) {
@@ -544,15 +546,15 @@ class SimplenewsAdministrationTest extends SimplenewsTestBase {
       'newsletters[' . $first . ']' => TRUE,
     ];
 
-    $this->drupalPostForm('admin/people/simplenews/import', $edit, t('Subscribe'));
+    $this->drupalPostForm('admin/people/simplenews/import', $edit, $this->t('Subscribe'));
     \Drupal::entityTypeManager()->getStorage('simplenews_subscriber')->resetCache();
     $subscription_manager->reset();
-    $this->assertFalse($subscription_manager->isSubscribed($tested_subscribers[0], $first), t('Subscriber not resubscribed through mass subscription.'));
-    $this->assertFalse($subscription_manager->isSubscribed($tested_subscribers[1], $first), t('Subscriber not resubscribed through mass subscription.'));
-    $this->assertTrue($subscription_manager->isSubscribed($tested_subscribers[2], $first), t('Subscriber subscribed through mass subscription.'));
+    $this->assertFalse($subscription_manager->isSubscribed($tested_subscribers[0], $first), $this->t('Subscriber not resubscribed through mass subscription.'));
+    $this->assertFalse($subscription_manager->isSubscribed($tested_subscribers[1], $first), $this->t('Subscriber not resubscribed through mass subscription.'));
+    $this->assertTrue($subscription_manager->isSubscribed($tested_subscribers[2], $first), $this->t('Subscriber subscribed through mass subscription.'));
     $substitutes = ['@name' => Newsletter::load($first)->label(), '@mail' => $unsubscribed];
-    $this->assertText(t('The following addresses were skipped because they have previously unsubscribed from @name: @mail.', $substitutes));
-    $this->assertText(t("If you would like to resubscribe them, use the 'Force resubscription' option."));
+    $this->assertText($this->t('The following addresses were skipped because they have previously unsubscribed from @name: @mail.', $substitutes));
+    $this->assertText($this->t("If you would like to resubscribe them, use the 'Force resubscription' option."));
 
     // Try to mass subscribe without specifying newsletters.
     $tested_subscribers[2] = $this->randomEmail();
@@ -561,7 +563,7 @@ class SimplenewsAdministrationTest extends SimplenewsTestBase {
       'resubscribe' => TRUE,
     ];
 
-    $this->drupalPostForm('admin/people/simplenews/import', $edit, t('Subscribe'));
+    $this->drupalPostForm('admin/people/simplenews/import', $edit, $this->t('Subscribe'));
     $this->assertText('Subscribe to field is required.');
 
     // Test mass subscribe with previously unsubscribed users and force
@@ -572,13 +574,13 @@ class SimplenewsAdministrationTest extends SimplenewsTestBase {
       'newsletters[' . $first . ']' => TRUE,
       'resubscribe' => TRUE,
     ];
-    $this->drupalPostForm('admin/people/simplenews/import', $edit, t('Subscribe'));
+    $this->drupalPostForm('admin/people/simplenews/import', $edit, $this->t('Subscribe'));
 
     $subscription_manager->reset();
     \Drupal::entityTypeManager()->getStorage('simplenews_subscriber')->resetCache();
-    $this->assertTrue($subscription_manager->isSubscribed($tested_subscribers[0], $first, t('Subscriber resubscribed trough mass subscription.')));
-    $this->assertTrue($subscription_manager->isSubscribed($tested_subscribers[1], $first, t('Subscriber resubscribed trough mass subscription.')));
-    $this->assertTrue($subscription_manager->isSubscribed($tested_subscribers[2], $first, t('Subscriber subscribed trough mass subscription.')));
+    $this->assertTrue($subscription_manager->isSubscribed($tested_subscribers[0], $first, $this->t('Subscriber resubscribed trough mass subscription.')));
+    $this->assertTrue($subscription_manager->isSubscribed($tested_subscribers[1], $first, $this->t('Subscriber resubscribed trough mass subscription.')));
+    $this->assertTrue($subscription_manager->isSubscribed($tested_subscribers[2], $first, $this->t('Subscriber subscribed trough mass subscription.')));
 
     // Try to mass unsubscribe without specifying newsletters.
     $tested_subscribers[2] = $this->randomEmail();
@@ -586,7 +588,7 @@ class SimplenewsAdministrationTest extends SimplenewsTestBase {
       'emails' => implode(', ', $tested_subscribers),
     ];
 
-    $this->drupalPostForm('admin/people/simplenews/unsubscribe', $edit, t('Unsubscribe'));
+    $this->drupalPostForm('admin/people/simplenews/unsubscribe', $edit, $this->t('Unsubscribe'));
     $this->assertText('Unsubscribe from field is required.');
 
     // Create two blocks, to ensure that they are updated/deleted when a
@@ -599,10 +601,10 @@ class SimplenewsAdministrationTest extends SimplenewsTestBase {
     // Delete newsletter.
     \Drupal::entityTypeManager()->getStorage('simplenews_newsletter')->resetCache();
     $this->drupalGet('admin/config/services/simplenews/manage/' . $first);
-    $this->clickLink(t('Delete'));
-    $this->drupalPostForm(NULL, [], t('Delete'));
+    $this->clickLink($this->t('Delete'));
+    $this->drupalPostForm(NULL, [], $this->t('Delete'));
 
-    $this->assertText(t('All subscriptions to newsletter @newsletter have been deleted.', ['@newsletter' => $newsletters[$first]->name]));
+    $this->assertText($this->t('All subscriptions to newsletter @newsletter have been deleted.', ['@newsletter' => $newsletters[$first]->name]));
 
     // Verify that all related data has been deleted/updated.
     $this->assertNull(Newsletter::load($first));
@@ -618,7 +620,7 @@ class SimplenewsAdministrationTest extends SimplenewsTestBase {
       $this->assertNoText($mail);
     }
 
-    $this->clickLink(t('Edit'), 1);
+    $this->clickLink($this->t('Edit'), 1);
 
     // Get the subscriber id from the path.
     $this->assertEqual(1, preg_match('|admin/people/simplenews/edit/(\d+)\?destination|', $this->getUrl(), $matches), 'Subscriber found');
@@ -631,10 +633,10 @@ class SimplenewsAdministrationTest extends SimplenewsTestBase {
     $edit = [
       'status' => FALSE,
     ];
-    $this->drupalPostForm(NULL, $edit, t('Save'));
+    $this->drupalPostForm(NULL, $edit, $this->t('Save'));
     \Drupal::entityTypeManager()->getStorage('simplenews_subscriber')->resetCache();
     $subscription_manager->reset();
-    $this->assertFalse($subscription_manager->isSubscribed($subscriber->getMail(), $this->getRandomNewsletter()), t('Subscriber is not active'));
+    $this->assertFalse($subscription_manager->isSubscribed($subscriber->getMail(), $this->getRandomNewsletter()), $this->t('Subscriber is not active'));
 
     // Re-enable account.
     $this->drupalGet('admin/people/simplenews/edit/' . $subscriber->id());
@@ -643,10 +645,10 @@ class SimplenewsAdministrationTest extends SimplenewsTestBase {
     $edit = [
       'status' => TRUE,
     ];
-    $this->drupalPostForm(NULL, $edit, t('Save'));
+    $this->drupalPostForm(NULL, $edit, $this->t('Save'));
     \Drupal::entityTypeManager()->getStorage('simplenews_subscriber')->resetCache();
     $subscription_manager->reset();
-    $this->assertTrue($subscription_manager->isSubscribed($subscriber->getMail(), $this->getRandomNewsletter()), t('Subscriber is active again.'));
+    $this->assertTrue($subscription_manager->isSubscribed($subscriber->getMail(), $this->getRandomNewsletter()), $this->t('Subscriber is active again.'));
 
     // Remove the newsletter.
     $this->drupalGet('admin/people/simplenews/edit/' . $subscriber->id());
@@ -657,11 +659,11 @@ class SimplenewsAdministrationTest extends SimplenewsTestBase {
     // If the subscriber still has subscribed to newsletter, try to unsubscribe.
     $newsletter_id = reset($nlids);
     $edit['subscriptions[' . $newsletter_id . ']'] = FALSE;
-    $this->drupalPostForm(NULL, $edit, t('Save'));
+    $this->drupalPostForm(NULL, $edit, $this->t('Save'));
     \Drupal::entityTypeManager()->getStorage('simplenews_subscriber')->resetCache();
     $subscription_manager->reset();
     $nlids = $subscriber->getSubscribedNewsletterIds();
-    $this->assertFalse($subscription_manager->isSubscribed($subscriber->getMail(), reset($nlids)), t('Subscriber not subscribed anymore.'));
+    $this->assertFalse($subscription_manager->isSubscribed($subscriber->getMail(), reset($nlids)), $this->t('Subscriber not subscribed anymore.'));
 
     /*
      * @todo Test Admin subscriber edit preferred $subscription->language
@@ -683,7 +685,7 @@ class SimplenewsAdministrationTest extends SimplenewsTestBase {
     // Create a new user for the next test.
     $new_user = $this->drupalCreateUser(['subscribe to newsletters']);
     // Test for saving the subscription for no newsletter.
-    $this->drupalPostForm('user/' . $new_user->id() . '/simplenews', NULL, t('Save'));
+    $this->drupalPostForm('user/' . $new_user->id() . '/simplenews', NULL, $this->t('Save'));
     $this->assertText('The newsletter subscriptions for user ' . $new_user->getAccountName() . ' have been updated.');
 
     // Editing a subscriber with subscription.
@@ -692,7 +694,7 @@ class SimplenewsAdministrationTest extends SimplenewsTestBase {
       'status' => TRUE,
       'mail[0][value]' => 'edit@example.com',
     ];
-    $this->drupalPostForm('admin/people/simplenews/edit/' . $xss_subscriber->id(), $edit, t('Save'));
+    $this->drupalPostForm('admin/people/simplenews/edit/' . $xss_subscriber->id(), $edit, $this->t('Save'));
     $this->assertText('Subscriber edit@example.com has been updated.');
 
     // Create a second newsletter.
@@ -701,14 +703,14 @@ class SimplenewsAdministrationTest extends SimplenewsTestBase {
       'name' => $second_newsletter_name,
       'id'  => $second_newsletter_name,
     ];
-    $this->drupalPostForm('admin/config/services/simplenews/add', $edit2, t('Save'));
+    $this->drupalPostForm('admin/config/services/simplenews/add', $edit2, $this->t('Save'));
 
     // Test for adding a subscriber.
     $subscribe = [
       'newsletters[' . $newsletter_name . ']' => TRUE,
       'emails' => 'drupaltest@example.com',
     ];
-    $this->drupalPostForm('admin/people/simplenews/import', $subscribe, t('Subscribe'));
+    $this->drupalPostForm('admin/people/simplenews/import', $subscribe, $this->t('Subscribe'));
 
     // The subscriber should appear once in the list.
     $rows = $this->xpath('//tbody/tr');
@@ -719,8 +721,8 @@ class SimplenewsAdministrationTest extends SimplenewsTestBase {
       }
     }
     $this->assertEqual(1, $counter);
-    $this->assertText(t('The following addresses were added or updated: @email.', ['@email' => 'drupaltest@example.com']));
-    $this->assertText(t('The addresses were subscribed to the following newsletters: @newsletter.', ['@newsletter' => $newsletter_name]));
+    $this->assertText($this->t('The following addresses were added or updated: @email.', ['@email' => 'drupaltest@example.com']));
+    $this->assertText($this->t('The addresses were subscribed to the following newsletters: @newsletter.', ['@newsletter' => $newsletter_name]));
 
     // Check exact subscription statuses.
     $subscriber = Subscriber::loadByMail('drupaltest@example.com');
@@ -748,7 +750,7 @@ class SimplenewsAdministrationTest extends SimplenewsTestBase {
     $this->drupalLogin($admin_user);
 
     $this->drupalGet('admin/structure/types');
-    $this->clickLink(t('Add content type'));
+    $this->clickLink($this->t('Add content type'));
     $name = $this->randomMachineName();
     $type = strtolower($name);
     $edit = [
@@ -756,11 +758,11 @@ class SimplenewsAdministrationTest extends SimplenewsTestBase {
       'type' => $type,
       'simplenews_content_type' => TRUE,
     ];
-    $this->drupalPostForm(NULL, $edit, t('Save content type'));
+    $this->drupalPostForm(NULL, $edit, $this->t('Save content type'));
 
     // Verify that the newsletter settings are shown.
     $this->drupalGet('node/add/' . $type);
-    $this->assertText(t('Issue'));
+    $this->assertText($this->t('Issue'));
 
     // Create an issue.
     $edit = [
@@ -785,8 +787,8 @@ class SimplenewsAdministrationTest extends SimplenewsTestBase {
     $node2 = $this->drupalGetNodeByTitle($edit['title[0][value]']);
 
     // Assert subscriber count.
-    $this->clickLink(t('Newsletter'));
-    $this->assertText(t('Send newsletter issue to 0 subscribers.'));
+    $this->clickLink($this->t('Newsletter'));
+    $this->assertText($this->t('Send newsletter issue to 0 subscribers.'));
 
     // Create some subscribers.
     $subscribers = [];
@@ -813,32 +815,32 @@ class SimplenewsAdministrationTest extends SimplenewsTestBase {
     // Send mails.
     $this->assertField('test_address', $admin_user->getEmail());
     // Test newsletter to empty address and check the error message.
-    $this->drupalPostForm(NULL, ['test_address' => ''], t('Send test newsletter issue'));
-    $this->assertText(t('Missing test email address.'));
+    $this->drupalPostForm(NULL, ['test_address' => ''], $this->t('Send test newsletter issue'));
+    $this->assertText($this->t('Missing test email address.'));
     // Test newsletter to invalid address and check the error message.
-    $this->drupalPostForm(NULL, ['test_address' => 'invalid_address'], t('Send test newsletter issue'));
-    $this->assertText(t('Invalid email address "invalid_address"'));
-    $this->drupalPostForm(NULL, ['test_address' => $admin_user->getEmail()], t('Send test newsletter issue'));
-    $this->assertText(t('Test newsletter sent to user @name &lt;@email&gt;', ['@name' => $admin_user->getAccountName(), '@email' => $admin_user->getEmail()]));
+    $this->drupalPostForm(NULL, ['test_address' => 'invalid_address'], $this->t('Send test newsletter issue'));
+    $this->assertText($this->t('Invalid email address "invalid_address"'));
+    $this->drupalPostForm(NULL, ['test_address' => $admin_user->getEmail()], $this->t('Send test newsletter issue'));
+    $this->assertText($this->t('Test newsletter sent to user @name &lt;@email&gt;', ['@name' => $admin_user->getAccountName(), '@email' => $admin_user->getEmail()]));
 
     $mails = $this->getMails();
     $this->assertEqual('simplenews_test', $mails[0]['id']);
     $this->assertEqual($admin_user->getEmail(), $mails[0]['to']);
-    $this->assertEqual(t('[Default newsletter] @title', ['@title' => $node->getTitle()]), $mails[0]['subject']);
+    $this->assertEqual($this->t('[Default newsletter] @title', ['@title' => $node->getTitle()]), $mails[0]['subject']);
     $this->assertTrue(strpos($mails[0]['body'], 'User ID: ' . $admin_user->id()) !== FALSE);
 
     // Update the content type, remove the simpletest checkbox.
     $edit = [
       'simplenews_content_type' => FALSE,
     ];
-    $this->drupalPostForm('admin/structure/types/manage/' . $type, $edit, t('Save content type'));
+    $this->drupalPostForm('admin/structure/types/manage/' . $type, $edit, $this->t('Save content type'));
 
     // Verify that the newsletter settings are still shown.
     // Note: Previously the field got autoremoved. We leave it remaining due to
     // potential data loss.
     $this->drupalGet('node/add/' . $type);
-    $this->assertNoText(t('Replacement patterns'));
-    $this->assertText(t('Issue'));
+    $this->assertNoText($this->t('Replacement patterns'));
+    $this->assertText($this->t('Issue'));
 
     // Test the visibility of subscription user component.
     $this->drupalGet('node/' . $node->id());
@@ -851,11 +853,11 @@ class SimplenewsAdministrationTest extends SimplenewsTestBase {
     // @todo: Test node update/delete.
     // Delete content type.
     // @todo: Add assertions.
-    $this->drupalPostForm('admin/structure/types/manage/' . $type . '/delete', [], t('Delete'));
+    $this->drupalPostForm('admin/structure/types/manage/' . $type . '/delete', [], $this->t('Delete'));
 
     // Check the Add Newsletter Issue button.
     $this->drupalGet('admin/content/simplenews');
-    $this->clickLink(t('Add Newsletter Issue'));
+    $this->clickLink($this->t('Add Newsletter Issue'));
     $this->assertUrl('node/add/simplenews_issue');
     // Check if the help text is displayed.
     $this->assertText('Add this newsletter issue to a newsletter by selecting a newsletter from the select list.');
@@ -907,12 +909,12 @@ class SimplenewsAdministrationTest extends SimplenewsTestBase {
     $row = $this->xpath('//tbody/tr');
     $this->assertEqual(1, count($row));
     $this->assertEqual($subscribers[1]->getMail(), trim($row[0]->find('xpath', '/td')->getText()));
-    $this->assertText($newsletters['default']->name . ' (' . t('Unconfirmed') . ')');
+    $this->assertText($newsletters['default']->name . ' (' . $this->t('Unconfirmed') . ')');
     $this->drupalGet('admin/people/simplenews', ['query' => ['subscriptions_status' => SIMPLENEWS_SUBSCRIPTION_STATUS_UNSUBSCRIBED]]);
     $row = $this->xpath('//tbody/tr');
     $this->assertEqual(1, count($row));
     $this->assertEqual($subscribers[2]->getMail(), trim($row[0]->find('xpath', '/td')->getText()));
-    $this->assertText($newsletters['default']->name . ' (' . t('Unsubscribed') . ')');
+    $this->assertText($newsletters['default']->name . ' (' . $this->t('Unsubscribed') . ')');
   }
 
   /**
@@ -938,14 +940,14 @@ class SimplenewsAdministrationTest extends SimplenewsTestBase {
       'name' => $name,
       'id'  => mb_strtolower($name),
     ];
-    $this->drupalPostForm('admin/config/services/simplenews/add', $edit, t('Save'));
+    $this->drupalPostForm('admin/config/services/simplenews/add', $edit, $this->t('Save'));
 
     // Create a newsletter issue and publish.
     $edit = [
       'title[0][value]' => 'Test_issue_1',
       'simplenews_issue[target_id]' => mb_strtolower($name),
     ];
-    $this->drupalPostForm('node/add/simplenews_issue', $edit, t('Save'));
+    $this->drupalPostForm('node/add/simplenews_issue', $edit, $this->t('Save'));
 
     // Create another newsletter issue and keep unpublished.
     $edit = [
@@ -953,7 +955,7 @@ class SimplenewsAdministrationTest extends SimplenewsTestBase {
       'simplenews_issue[target_id]' => mb_strtolower($name),
       'status[value]' => FALSE,
     ];
-    $this->drupalPostForm('node/add/simplenews_issue', $edit, t('Save'));
+    $this->drupalPostForm('node/add/simplenews_issue', $edit, $this->t('Save'));
 
     // Test mass subscribe with previously unsubscribed users.
     for ($i = 0; $i < 3; $i++) {
@@ -963,7 +965,7 @@ class SimplenewsAdministrationTest extends SimplenewsTestBase {
       'emails' => implode(', ', $subscribers),
       'newsletters[' . mb_strtolower($name) . ']' => TRUE,
     ];
-    $this->drupalPostForm('admin/people/simplenews/import', $edit, t('Subscribe'));
+    $this->drupalPostForm('admin/people/simplenews/import', $edit, $this->t('Subscribe'));
 
     $this->drupalGet('admin/content/simplenews');
     // Check the correct values are present in the view.
@@ -988,7 +990,7 @@ class SimplenewsAdministrationTest extends SimplenewsTestBase {
       'node_bulk_form[1]' => TRUE,
       'action' => 'simplenews_send_action',
     ];
-    $this->drupalPostForm(NULL, $edit, t('Apply to selected items'));
+    $this->drupalPostForm(NULL, $edit, $this->t('Apply to selected items'));
     // Check the relevant messages.
     $this->assertText('Newsletter issue Test_issue_2 will be sent when published.');
     $this->assertText('Newsletter issue Test_issue_1 pending.');
@@ -1009,7 +1011,7 @@ class SimplenewsAdministrationTest extends SimplenewsTestBase {
       'node_bulk_form[1]' => TRUE,
       'action' => 'simplenews_stop_action',
     ];
-    $this->drupalPostForm(NULL, $edit, t('Apply to selected items'));
+    $this->drupalPostForm(NULL, $edit, $this->t('Apply to selected items'));
     // Check the stop message.
     $this->assertText('Sending of Test_issue_1 was stopped. 3 pending email(s) were deleted.');
     $rows = $this->xpath('//tbody/tr');
@@ -1029,7 +1031,7 @@ class SimplenewsAdministrationTest extends SimplenewsTestBase {
       'node_bulk_form[1]' => TRUE,
       'action' => 'simplenews_send_action',
     ];
-    $this->drupalPostForm(NULL, $edit, t('Apply to selected items'));
+    $this->drupalPostForm(NULL, $edit, $this->t('Apply to selected items'));
     // Run cron to send the mails.
     $this->cronRun();
     $this->drupalGet('admin/content/simplenews');
@@ -1062,7 +1064,7 @@ class SimplenewsAdministrationTest extends SimplenewsTestBase {
       'name' => $newsletter_name,
       'id'  => $newsletter_name,
     ];
-    $this->drupalPostForm('admin/config/services/simplenews/add', $edit, t('Save'));
+    $this->drupalPostForm('admin/config/services/simplenews/add', $edit, $this->t('Save'));
 
     // Create a user and subscribe them.
     $user = $this->drupalCreateUser();
diff --git a/tests/src/Functional/SimplenewsFieldUiTest.php b/tests/src/Functional/SimplenewsFieldUiTest.php
index 2dd3856..e1baf4b 100644
--- a/tests/src/Functional/SimplenewsFieldUiTest.php
+++ b/tests/src/Functional/SimplenewsFieldUiTest.php
@@ -45,7 +45,7 @@ class SimplenewsFieldUiTest extends SimplenewsTestBase {
     $this->drupalLogin($admin_user);
 
     $this->drupalGet('admin/structure/types');
-    $this->clickLink(t('Add content type'));
+    $this->clickLink($this->t('Add content type'));
     $name = 'simplenews_issue';
     $type = strtolower($name);
     $edit = [
@@ -53,7 +53,7 @@ class SimplenewsFieldUiTest extends SimplenewsTestBase {
       'type' => $type,
       'simplenews_content_type' => TRUE,
     ];
-    $this->drupalPostForm(NULL, $edit, t('Save and manage fields'));
+    $this->drupalPostForm(NULL, $edit, $this->t('Save and manage fields'));
     $this->drupalGet('admin/structure/types/manage/' . $type . '/fields');
     $this->assertText('simplenews_issue');
     // Check if the help text is displayed.
diff --git a/tests/src/Functional/SimplenewsI18nTest.php b/tests/src/Functional/SimplenewsI18nTest.php
index 978844e..35c3fa5 100644
--- a/tests/src/Functional/SimplenewsI18nTest.php
+++ b/tests/src/Functional/SimplenewsI18nTest.php
@@ -121,7 +121,7 @@ class SimplenewsI18nTest extends SimplenewsTestBase {
     $edit = [
       'language_configuration[content_translation]' => TRUE,
     ];
-    $this->drupalPostForm('admin/structure/types/manage/simplenews_issue', $edit, t('Save content type'));
+    $this->drupalPostForm('admin/structure/types/manage/simplenews_issue', $edit, $this->t('Save content type'));
 
     // Create a Newsletter including a translation.
     $newsletter_id = $this->getRandomNewsletter();
@@ -134,21 +134,21 @@ class SimplenewsI18nTest extends SimplenewsTestBase {
     $this->assertEqual(1, preg_match('|node/(\d+)$|', $this->getUrl(), $matches), 'Node created');
     $node = Node::load($matches[1]);
 
-    $this->clickLink(t('Translate'));
-    $this->clickLink(t('Add'));
+    $this->clickLink($this->t('Translate'));
+    $this->clickLink($this->t('Add'));
     $spanish = [
       'title[0][value]' => $this->randomMachineName(),
       'body[0][value]' => 'Link to node: [node:url] ES',
     ];
-    $this->drupalPostForm(NULL, $spanish, t('Save (this translation)'));
+    $this->drupalPostForm(NULL, $spanish, $this->t('Save (this translation)'));
 
     \Drupal::entityTypeManager()->getStorage('node')->resetCache([$node->id()]);
     $node = Node::load($node->id());
     $translation = $node->getTranslation($this->secondaryLanguage);
 
     // Send newsletter.
-    $this->clickLink(t('Newsletter'));
-    $this->drupalPostForm(NULL, [], t('Send now'));
+    $this->clickLink($this->t('Newsletter'));
+    $this->drupalPostForm(NULL, [], $this->t('Send now'));
     $this->cronRun();
     // @codingStandardsIgnoreLine
     //simplenews_cron();
@@ -172,7 +172,7 @@ class SimplenewsI18nTest extends SimplenewsTestBase {
         $title = $translation->getTitle();
       }
       else {
-        $this->fail(t('Mail not sent to expected recipient'));
+        $this->fail($this->t('Mail not sent to expected recipient'));
       }
 
       // Verify that the link is in the correct language.
@@ -195,11 +195,11 @@ class SimplenewsI18nTest extends SimplenewsTestBase {
       'body[0][value]' => 'Link to node: [node:url]',
     ];
     $this->drupalPostForm('node/add/simplenews_issue', $english, ('Save'));
-    $this->clickLink(t('Edit'));
+    $this->clickLink($this->t('Edit'));
     $edit = [
       'langcode[0][value]' => 'es',
     ];
-    $this->drupalPostForm(NULL, $edit, t('Save'));
+    $this->drupalPostForm(NULL, $edit, $this->t('Save'));
   }
 
 }
diff --git a/tests/src/Functional/SimplenewsPersonalizationFormsTest.php b/tests/src/Functional/SimplenewsPersonalizationFormsTest.php
index 9f4de65..f76a6ff 100644
--- a/tests/src/Functional/SimplenewsPersonalizationFormsTest.php
+++ b/tests/src/Functional/SimplenewsPersonalizationFormsTest.php
@@ -74,14 +74,14 @@ class SimplenewsPersonalizationFormsTest extends SimplenewsTestBase {
 
     // Attempt subscribe and assert login message.
     $this->subscribe('default', $email);
-    $this->assertRaw(t('There is an account registered for the e-mail address %mail. Please log in to manage your newsletter subscriptions', ['%mail' => $email]));
+    $this->assertRaw($this->t('There is an account registered for the e-mail address %mail. Please log in to manage your newsletter subscriptions', ['%mail' => $email]));
 
     // Login.
     $this->resetPassLogin($user);
 
     // Subscribe.
     $new_value = $this->randomString(20);
-    $this->subscribe('default', NULL, ['field_shared[0][value]' => $new_value], t('Update'));
+    $this->subscribe('default', NULL, ['field_shared[0][value]' => $new_value], $this->t('Update'));
 
     // Assert fields are updated.
     $this->drupalGet("user/$uid");
@@ -100,10 +100,10 @@ class SimplenewsPersonalizationFormsTest extends SimplenewsTestBase {
     // Request new password.
     $this->drupalPostForm('user/password', [
       'name' => $email,
-    ], t('Submit'));
+    ], $this->t('Submit'));
 
     // Assert the email is not recognized as an account.
-    $this->assertRaw(t('%name is not recognized as a username or an email address.', ['%name' => $email]));
+    $this->assertRaw($this->t('%name is not recognized as a username or an email address.', ['%name' => $email]));
   }
 
   /**
@@ -117,12 +117,12 @@ class SimplenewsPersonalizationFormsTest extends SimplenewsTestBase {
 
     // Subscribe.
     $this->resetPassLogin(User::load($uid));
-    $this->subscribe('default', NULL, [], t('Update'));
+    $this->subscribe('default', NULL, [], $this->t('Update'));
     $this->drupalLogout();
 
     // Disable account.
     $this->drupalLogin($this->admin);
-    $this->drupalPostForm("user/$uid/cancel", [], t('Cancel account'));
+    $this->drupalPostForm("user/$uid/cancel", [], $this->t('Cancel account'));
 
     // Assert subscriber is inactive.
     $subscriber = $this->getLatestSubscriber();
@@ -143,7 +143,7 @@ class SimplenewsPersonalizationFormsTest extends SimplenewsTestBase {
 
     // Delete account.
     $this->drupalLogin($this->admin);
-    $this->drupalPostForm("user/$uid/cancel", ['user_cancel_method' => 'user_cancel_reassign'], t('Cancel account'));
+    $this->drupalPostForm("user/$uid/cancel", ['user_cancel_method' => 'user_cancel_reassign'], $this->t('Cancel account'));
 
     // Assert subscriptions are deleted.
     $subscriber = $this->getLatestSubscriber();
@@ -161,12 +161,12 @@ class SimplenewsPersonalizationFormsTest extends SimplenewsTestBase {
 
     // Block account.
     $this->drupalLogin($this->admin);
-    $this->drupalPostForm("user/$uid/edit", ['status' => 0], t('Save'));
+    $this->drupalPostForm("user/$uid/edit", ['status' => 0], $this->t('Save'));
     $this->drupalLogout();
 
     // Attempt subscribe and assert "blocked" message.
     $this->subscribe('default', $email);
-    $this->assertRaw(t('The email address %mail belongs to a blocked user.', ['%mail' => $email]));
+    $this->assertRaw($this->t('The email address %mail belongs to a blocked user.', ['%mail' => $email]));
   }
 
 }
diff --git a/tests/src/Functional/SimplenewsRecipientHandlerTest.php b/tests/src/Functional/SimplenewsRecipientHandlerTest.php
index 88eb6be..14e47fa 100644
--- a/tests/src/Functional/SimplenewsRecipientHandlerTest.php
+++ b/tests/src/Functional/SimplenewsRecipientHandlerTest.php
@@ -43,19 +43,19 @@ class SimplenewsRecipientHandlerTest extends SimplenewsTestBase {
   public function testSiteMail() {
     // Verify that the recipient handler settings are shown.
     $this->drupalGet('node/add/simplenews_issue');
-    $this->assertText(t('Recipients'));
-    $this->assertText(t('How recipients should be selected.'));
+    $this->assertText($this->t('Recipients'));
+    $this->assertText($this->t('How recipients should be selected.'));
 
     $edit = [
       'title[0][value]' => $this->randomString(10),
       'simplenews_issue[target_id]' => 'default',
       'simplenews_issue[handler]' => 'simplenews_site_mail',
     ];
-    $this->drupalPostForm(NULL, $edit, t('Save'));
+    $this->drupalPostForm(NULL, $edit, $this->t('Save'));
 
-    $this->clickLink(t('Newsletter'));
-    $this->assertText(t('Send newsletter issue to 1 subscribers.'));
-    $this->drupalPostForm(NULL, [], t('Send now'));
+    $this->clickLink($this->t('Newsletter'));
+    $this->assertText($this->t('Send newsletter issue to 1 subscribers.'));
+    $this->drupalPostForm(NULL, [], $this->t('Send now'));
     $this->checkRecipients(['simpletest@example.com' => 1]);
   }
 
@@ -75,11 +75,11 @@ class SimplenewsRecipientHandlerTest extends SimplenewsTestBase {
       'simplenews_issue[target_id]' => 'default',
       'simplenews_issue[handler]' => 'simplenews_new_users',
     ];
-    $this->drupalPostForm(NULL, $edit, t('Save'));
+    $this->drupalPostForm(NULL, $edit, $this->t('Save'));
 
-    $this->clickLink(t('Newsletter'));
-    $this->assertText(t('Send newsletter issue to 3 subscribers.'));
-    $this->drupalPostForm(NULL, [], t('Send now'));
+    $this->clickLink($this->t('Newsletter'));
+    $this->assertText($this->t('Send newsletter issue to 3 subscribers.'));
+    $this->drupalPostForm(NULL, [], $this->t('Send now'));
     $this->checkRecipients(array_slice($users, 0, 3));
   }
 
@@ -102,19 +102,19 @@ class SimplenewsRecipientHandlerTest extends SimplenewsTestBase {
       'simplenews_issue[target_id]' => 'default',
       'simplenews_issue[handler]' => 'simplenews_subscribers_by_role',
     ];
-    $this->drupalPostForm(NULL, $edit, t('Save'));
+    $this->drupalPostForm(NULL, $edit, $this->t('Save'));
 
     // Edit and set the role.
-    $this->clickLink(t('Edit'));
-    $this->assertText(t('Role'));
+    $this->clickLink($this->t('Edit'));
+    $this->assertText($this->t('Role'));
     $edit = [
       'simplenews_issue[handler_settings][role]' => $rid,
     ];
-    $this->drupalPostForm(NULL, $edit, t('Save'));
+    $this->drupalPostForm(NULL, $edit, $this->t('Save'));
 
-    $this->clickLink(t('Newsletter'));
-    $this->assertText(t('Send newsletter issue to 2 subscribers.'));
-    $this->drupalPostForm(NULL, [], t('Send now'));
+    $this->clickLink($this->t('Newsletter'));
+    $this->assertText($this->t('Send newsletter issue to 2 subscribers.'));
+    $this->drupalPostForm(NULL, [], $this->t('Send now'));
     $this->checkRecipients($recipients);
   }
 
@@ -140,9 +140,9 @@ class SimplenewsRecipientHandlerTest extends SimplenewsTestBase {
   protected function checkRecipients(array $expected) {
     simplenews_cron();
     $mails = $this->getMails();
-    $this->assertEqual(count($expected), count($mails), t('All mails were sent.'));
+    $this->assertEqual(count($expected), count($mails), $this->t('All mails were sent.'));
     foreach ($mails as $mail) {
-      $this->assertTrue(isset($expected[$mail['to']]), t('Found valid recipient @recip', ['@recip' => $mail['to']]));
+      $this->assertTrue(isset($expected[$mail['to']]), $this->t('Found valid recipient @recip', ['@recip' => $mail['to']]));
       unset($expected[$mail['to']]);
     }
   }
diff --git a/tests/src/Functional/SimplenewsSendTest.php b/tests/src/Functional/SimplenewsSendTest.php
index 9a2f6a5..d6c0d4f 100644
--- a/tests/src/Functional/SimplenewsSendTest.php
+++ b/tests/src/Functional/SimplenewsSendTest.php
@@ -62,13 +62,13 @@ class SimplenewsSendTest extends SimplenewsTestBase {
 
     // Verify mails.
     $mails = $this->getMails();
-    $this->assertEqual(5, count($mails), t('All mails were sent.'));
+    $this->assertEqual(5, count($mails), $this->t('All mails were sent.'));
     foreach ($mails as $mail) {
-      $this->assertEqual($mail['subject'], '[Default newsletter] ' . $node->getTitle(), t('Mail has correct subject'));
-      $this->assertTrue(isset($this->subscribers[$mail['to']]), t('Found valid recipient'));
+      $this->assertEqual($mail['subject'], '[Default newsletter] ' . $node->getTitle(), $this->t('Mail has correct subject'));
+      $this->assertTrue(isset($this->subscribers[$mail['to']]), $this->t('Found valid recipient'));
       unset($this->subscribers[$mail['to']]);
     }
-    $this->assertEqual(0, count($this->subscribers), t('all subscribers have been received a mail'));
+    $this->assertEqual(0, count($this->subscribers), $this->t('all subscribers have been received a mail'));
 
     // Create another node.
     $node = Node::create([
@@ -110,7 +110,7 @@ class SimplenewsSendTest extends SimplenewsTestBase {
 
     // Verify that the newsletter settings are shown.
     $this->drupalGet('node/add/simplenews_issue');
-    $this->assertText(t('Create Newsletter Issue'));
+    $this->assertText($this->t('Create Newsletter Issue'));
 
     $edit = [
       'title[0][value]' => $this->randomString(10),
@@ -120,31 +120,31 @@ class SimplenewsSendTest extends SimplenewsTestBase {
     $this->assertEqual(1, preg_match('|node/(\d+)$|', $this->getUrl(), $matches), 'Node created');
     $node = Node::load($matches[1]);
 
-    $this->clickLink(t('Newsletter'));
-    $this->assertText(t('Send'));
-    $this->assertText(t('Test'));
-    $this->assertNoText(t('Send newsletter when published'));
+    $this->clickLink($this->t('Newsletter'));
+    $this->assertText($this->t('Send'));
+    $this->assertText($this->t('Test'));
+    $this->assertNoText($this->t('Send newsletter when published'));
 
     // Verify state.
-    $this->assertEqual(SIMPLENEWS_STATUS_SEND_NOT, $node->simplenews_issue->status, t('Newsletter not sent yet.'));
+    $this->assertEqual(SIMPLENEWS_STATUS_SEND_NOT, $node->simplenews_issue->status, $this->t('Newsletter not sent yet.'));
 
     // Send now.
-    $this->drupalPostForm(NULL, [], t('Send now'));
+    $this->drupalPostForm(NULL, [], $this->t('Send now'));
 
     // Verify state.
     \Drupal::entityTypeManager()->getStorage('node')->resetCache();
     $node = Node::load($node->id());
-    $this->assertEqual(SIMPLENEWS_STATUS_SEND_READY, $node->simplenews_issue->status, t('Newsletter sending finished'));
+    $this->assertEqual(SIMPLENEWS_STATUS_SEND_READY, $node->simplenews_issue->status, $this->t('Newsletter sending finished'));
 
     // Verify mails.
     $mails = $this->getMails();
-    $this->assertEqual(5, count($mails), t('All mails were sent.'));
+    $this->assertEqual(5, count($mails), $this->t('All mails were sent.'));
     foreach ($mails as $mail) {
-      $this->assertEqual($mail['subject'], '[Default newsletter] ' . $edit['title[0][value]'], t('Mail has correct subject'));
-      $this->assertTrue(isset($this->subscribers[$mail['to']]), t('Found valid recipient'));
+      $this->assertEqual($mail['subject'], '[Default newsletter] ' . $edit['title[0][value]'], $this->t('Mail has correct subject'));
+      $this->assertTrue(isset($this->subscribers[$mail['to']]), $this->t('Found valid recipient'));
       unset($this->subscribers[$mail['to']]);
     }
-    $this->assertEqual(0, count($this->subscribers), t('all subscribers have been received a mail'));
+    $this->assertEqual(0, count($this->subscribers), $this->t('all subscribers have been received a mail'));
 
     $this->assertEqual(5, $node->simplenews_issue->sent_count, 'subscriber count is correct');
   }
@@ -162,7 +162,7 @@ class SimplenewsSendTest extends SimplenewsTestBase {
     $nodes = [];
     for ($i = 0; $i < 3; $i++) {
       $this->drupalGet('node/add/simplenews_issue');
-      $this->assertText(t('Create Newsletter Issue'));
+      $this->assertText($this->t('Create Newsletter Issue'));
 
       $edit = [
         'title[0][value]' => $this->randomString(10),
@@ -176,7 +176,7 @@ class SimplenewsSendTest extends SimplenewsTestBase {
 
       // Verify state.
       $node = current($nodes);
-      $this->assertEqual(SIMPLENEWS_STATUS_SEND_NOT, $node->simplenews_issue->status, t('Newsletter not sent yet.'));
+      $this->assertEqual(SIMPLENEWS_STATUS_SEND_NOT, $node->simplenews_issue->status, $this->t('Newsletter not sent yet.'));
     }
   }
 
@@ -190,7 +190,7 @@ class SimplenewsSendTest extends SimplenewsTestBase {
 
     // Verify that the newsletter settings are shown.
     $this->drupalGet('node/add/simplenews_issue');
-    $this->assertText(t('Create Newsletter Issue'));
+    $this->assertText($this->t('Create Newsletter Issue'));
 
     $edit = [
       'title[0][value]' => $this->randomString(10),
@@ -200,29 +200,29 @@ class SimplenewsSendTest extends SimplenewsTestBase {
     $this->assertEqual(1, preg_match('|node/(\d+)$|', $this->getUrl(), $matches), 'Node created');
     $node = Node::load($matches[1]);
 
-    $this->clickLink(t('Newsletter'));
-    $this->assertText(t('Send'));
-    $this->assertText(t('Test'));
+    $this->clickLink($this->t('Newsletter'));
+    $this->assertText($this->t('Send'));
+    $this->assertText($this->t('Test'));
 
     // Verify state.
     \Drupal::entityTypeManager()->getStorage('node')->resetCache();
     $node = Node::load($node->id());
-    $this->assertEqual(SIMPLENEWS_STATUS_SEND_NOT, $node->simplenews_issue->status, t('Newsletter not sent yet.'));
+    $this->assertEqual(SIMPLENEWS_STATUS_SEND_NOT, $node->simplenews_issue->status, $this->t('Newsletter not sent yet.'));
 
     // Send now.
-    $this->drupalPostForm(NULL, [], t('Send now'));
+    $this->drupalPostForm(NULL, [], $this->t('Send now'));
 
     // Verify state.
     \Drupal::entityTypeManager()->getStorage('node')->resetCache();
     $node = Node::load($node->id());
-    $this->assertEqual(SIMPLENEWS_STATUS_SEND_PENDING, $node->simplenews_issue->status, t('Newsletter sending pending.'));
+    $this->assertEqual(SIMPLENEWS_STATUS_SEND_PENDING, $node->simplenews_issue->status, $this->t('Newsletter sending pending.'));
 
     // Verify that no mails have been sent yet.
     $mails = $this->getMails();
-    $this->assertEqual(0, count($mails), t('No mails were sent yet.'));
+    $this->assertEqual(0, count($mails), $this->t('No mails were sent yet.'));
 
     $spooled = \Drupal::database()->query('SELECT COUNT(*) FROM {simplenews_mail_spool} WHERE entity_id = :nid AND entity_type = :type', [':nid' => $node->id(), ':type' => 'node'])->fetchField();
-    $this->assertEqual(5, $spooled, t('5 mails have been added to the mail spool'));
+    $this->assertEqual(5, $spooled, $this->t('5 mails have been added to the mail spool'));
 
     // Run cron for the first time.
     simplenews_cron();
@@ -230,11 +230,11 @@ class SimplenewsSendTest extends SimplenewsTestBase {
     // Verify state.
     \Drupal::entityTypeManager()->getStorage('node')->resetCache();
     $node = Node::load($node->id());
-    $this->assertEqual(SIMPLENEWS_STATUS_SEND_PENDING, $node->simplenews_issue->status, t('Newsletter sending pending.'));
+    $this->assertEqual(SIMPLENEWS_STATUS_SEND_PENDING, $node->simplenews_issue->status, $this->t('Newsletter sending pending.'));
     $this->assertEqual(3, $node->simplenews_issue->sent_count, 'subscriber count is correct');
 
     $spooled = \Drupal::database()->query('SELECT COUNT(*) FROM {simplenews_mail_spool} WHERE entity_id = :nid AND entity_type = :type', [':nid' => $node->id(), ':type' => 'node'])->fetchField();
-    $this->assertEqual(2, $spooled, t('2 mails remaining in spool.'));
+    $this->assertEqual(2, $spooled, $this->t('2 mails remaining in spool.'));
 
     // Run cron for the second time.
     simplenews_cron();
@@ -242,20 +242,20 @@ class SimplenewsSendTest extends SimplenewsTestBase {
     // Verify state.
     \Drupal::entityTypeManager()->getStorage('node')->resetCache();
     $node = Node::load($node->id());
-    $this->assertEqual(SIMPLENEWS_STATUS_SEND_READY, $node->simplenews_issue->status, t('Newsletter sending finished.'));
+    $this->assertEqual(SIMPLENEWS_STATUS_SEND_READY, $node->simplenews_issue->status, $this->t('Newsletter sending finished.'));
 
     $spooled = \Drupal::database()->query('SELECT COUNT(*) FROM {simplenews_mail_spool} WHERE entity_id = :nid AND entity_type = :type', [':nid' => $node->id(), ':type' => 'node'])->fetchField();
-    $this->assertEqual(0, $spooled, t('No mails remaining in spool.'));
+    $this->assertEqual(0, $spooled, $this->t('No mails remaining in spool.'));
 
     // Verify mails.
     $mails = $this->getMails();
-    $this->assertEqual(5, count($mails), t('All mails were sent.'));
+    $this->assertEqual(5, count($mails), $this->t('All mails were sent.'));
     foreach ($mails as $mail) {
-      $this->assertEqual($mail['subject'], '[Default newsletter] ' . $edit['title[0][value]'], t('Mail has correct subject'));
-      $this->assertTrue(isset($this->subscribers[$mail['to']]), t('Found valid recipient'));
+      $this->assertEqual($mail['subject'], '[Default newsletter] ' . $edit['title[0][value]'], $this->t('Mail has correct subject'));
+      $this->assertTrue(isset($this->subscribers[$mail['to']]), $this->t('Found valid recipient'));
       unset($this->subscribers[$mail['to']]);
     }
-    $this->assertEqual(0, count($this->subscribers), t('all subscribers have been received a mail'));
+    $this->assertEqual(0, count($this->subscribers), $this->t('all subscribers have been received a mail'));
     $this->assertEqual(5, $node->simplenews_issue->sent_count);
   }
 
@@ -266,50 +266,50 @@ class SimplenewsSendTest extends SimplenewsTestBase {
 
     // Verify that the newsletter settings are shown.
     $this->drupalGet('node/add/simplenews_issue');
-    $this->assertText(t('Create Newsletter Issue'));
+    $this->assertText($this->t('Create Newsletter Issue'));
 
     $edit = [
       'title[0][value]' => $this->randomString(10),
       'simplenews_issue[target_id]' => 'default',
     ];
     // Try preview first.
-    $this->drupalPostForm(NULL, $edit, t('Preview'));
+    $this->drupalPostForm(NULL, $edit, $this->t('Preview'));
 
-    $this->clickLink(t('Back to content editing'));
+    $this->clickLink($this->t('Back to content editing'));
 
     // Then save.
-    $this->drupalPostForm(NULL, [], t('Save'));
+    $this->drupalPostForm(NULL, [], $this->t('Save'));
 
     $this->assertEqual(1, preg_match('|node/(\d+)$|', $this->getUrl(), $matches), 'Node created');
     $node = Node::load($matches[1]);
 
-    $this->clickLink(t('Newsletter'));
-    $this->assertText(t('Send'));
-    $this->assertText(t('Test'));
+    $this->clickLink($this->t('Newsletter'));
+    $this->assertText($this->t('Send'));
+    $this->assertText($this->t('Test'));
 
     // Verify state.
     \Drupal::entityTypeManager()->getStorage('node')->resetCache();
     $node = Node::load($node->id());
-    $this->assertEqual(SIMPLENEWS_STATUS_SEND_NOT, $node->simplenews_issue->status, t('Newsletter not sent yet.'));
+    $this->assertEqual(SIMPLENEWS_STATUS_SEND_NOT, $node->simplenews_issue->status, $this->t('Newsletter not sent yet.'));
 
     // Send now.
-    $this->drupalPostForm(NULL, [], t('Send now'));
+    $this->drupalPostForm(NULL, [], $this->t('Send now'));
 
     // Verify state.
     \Drupal::entityTypeManager()->getStorage('node')->resetCache();
     $node = Node::load($node->id());
-    $this->assertEqual(SIMPLENEWS_STATUS_SEND_PENDING, $node->simplenews_issue->status, t('Newsletter sending pending.'));
+    $this->assertEqual(SIMPLENEWS_STATUS_SEND_PENDING, $node->simplenews_issue->status, $this->t('Newsletter sending pending.'));
 
     // Verify that no mails have been sent yet.
     $mails = $this->getMails();
-    $this->assertEqual(0, count($mails), t('No mails were sent yet.'));
+    $this->assertEqual(0, count($mails), $this->t('No mails were sent yet.'));
 
     $spooled = \Drupal::database()->query('SELECT COUNT(*) FROM {simplenews_mail_spool} WHERE entity_id = :nid AND entity_type = :type', [':nid' => $node->id(), ':type' => 'node'])->fetchField();
-    $this->assertEqual(5, $spooled, t('5 mails have been added to the mail spool'));
+    $this->assertEqual(5, $spooled, $this->t('5 mails have been added to the mail spool'));
 
     // Check warning message on node edit form.
-    $this->clickLink(t('Edit'));
-    $this->assertText(t('This newsletter issue is currently being sent. Any changes will be reflected in the e-mails which have not been sent yet.'));
+    $this->clickLink($this->t('Edit'));
+    $this->assertText($this->t('This newsletter issue is currently being sent. Any changes will be reflected in the e-mails which have not been sent yet.'));
 
     // Run cron.
     simplenews_cron();
@@ -317,22 +317,22 @@ class SimplenewsSendTest extends SimplenewsTestBase {
     // Verify state.
     \Drupal::entityTypeManager()->getStorage('node')->resetCache();
     $node = Node::load($node->id());
-    $this->assertEqual(SIMPLENEWS_STATUS_SEND_READY, $node->simplenews_issue->status, t('Newsletter sending finished.'));
+    $this->assertEqual(SIMPLENEWS_STATUS_SEND_READY, $node->simplenews_issue->status, $this->t('Newsletter sending finished.'));
 
     $spooled = \Drupal::database()->query('SELECT COUNT(*) FROM {simplenews_mail_spool} WHERE entity_id = :nid AND entity_type = :type', [':nid' => $node->id(), ':type' => 'node'])->fetchField();
-    $this->assertEqual(0, $spooled, t('No mails remaining in spool.'));
+    $this->assertEqual(0, $spooled, $this->t('No mails remaining in spool.'));
 
     // Verify mails.
     $mails = $this->getMails();
-    $this->assertEqual(5, count($mails), t('All mails were sent.'));
+    $this->assertEqual(5, count($mails), $this->t('All mails were sent.'));
     foreach ($mails as $mail) {
       // @todo Temporarily strip tags from mail subjects until
       //   https://www.drupal.org/node/2575791 is fixed.
-      $this->assertEqual($mail['subject'], '[Default newsletter] ' . strip_tags($edit['title[0][value]']), t('Mail has correct subject'));
-      $this->assertTrue(isset($this->subscribers[$mail['to']]), t('Found valid recipient'));
+      $this->assertEqual($mail['subject'], '[Default newsletter] ' . strip_tags($edit['title[0][value]']), $this->t('Mail has correct subject'));
+      $this->assertTrue(isset($this->subscribers[$mail['to']]), $this->t('Found valid recipient'));
       unset($this->subscribers[$mail['to']]);
     }
-    $this->assertEqual(0, count($this->subscribers), t('all subscribers have been received a mail'));
+    $this->assertEqual(0, count($this->subscribers), $this->t('all subscribers have been received a mail'));
   }
 
   /**
@@ -346,7 +346,7 @@ class SimplenewsSendTest extends SimplenewsTestBase {
 
     // Verify that the newsletter settings are shown.
     $this->drupalGet('node/add/simplenews_issue');
-    $this->assertText(t('Create Newsletter Issue'));
+    $this->assertText($this->t('Create Newsletter Issue'));
 
     $edit = [
       'title[0][value]' => $this->randomString(10),
@@ -357,25 +357,25 @@ class SimplenewsSendTest extends SimplenewsTestBase {
     $this->assertEqual(1, preg_match('|node/(\d+)$|', $this->getUrl(), $matches), 'Node created');
     $node = Node::load($matches[1]);
 
-    $this->clickLink(t('Newsletter'));
-    $this->assertText(t('Send'));
-    $this->assertText(t('Test'));
+    $this->clickLink($this->t('Newsletter'));
+    $this->assertText($this->t('Send'));
+    $this->assertText($this->t('Test'));
 
     // Verify state.
     \Drupal::entityTypeManager()->getStorage('node')->resetCache();
     $node = Node::load($node->id());
-    $this->assertEqual(SIMPLENEWS_STATUS_SEND_NOT, $node->simplenews_issue->status, t('Newsletter not sent yet.'));
+    $this->assertEqual(SIMPLENEWS_STATUS_SEND_NOT, $node->simplenews_issue->status, $this->t('Newsletter not sent yet.'));
 
     // Send now.
-    $this->drupalPostForm(NULL, [], t('Send on publish'));
+    $this->drupalPostForm(NULL, [], $this->t('Send on publish'));
 
     // Verify state.
     \Drupal::entityTypeManager()->getStorage('node')->resetCache([$node->id()]);
     $node = Node::load($node->id());
-    $this->assertEqual(SIMPLENEWS_STATUS_SEND_PUBLISH, $node->simplenews_issue->status, t('Newsletter set up for sending on publish.'));
+    $this->assertEqual(SIMPLENEWS_STATUS_SEND_PUBLISH, $node->simplenews_issue->status, $this->t('Newsletter set up for sending on publish.'));
 
-    $this->clickLink(t('Edit'));
-    $this->drupalPostForm(NULL, ['status[value]' => TRUE], t('Save'));
+    $this->clickLink($this->t('Edit'));
+    $this->drupalPostForm(NULL, ['status[value]' => TRUE], $this->t('Save'));
 
     // Send on publish does not send immediately.
     \Drupal::entityTypeManager()->getStorage('node')->resetCache([$node->id()]);
@@ -384,17 +384,17 @@ class SimplenewsSendTest extends SimplenewsTestBase {
     // Verify state.
     \Drupal::entityTypeManager()->getStorage('node')->resetCache([$node->id()]);
     $node = Node::load($node->id());
-    $this->assertEqual(SIMPLENEWS_STATUS_SEND_READY, $node->simplenews_issue->status, t('Newsletter sending finished'));
+    $this->assertEqual(SIMPLENEWS_STATUS_SEND_READY, $node->simplenews_issue->status, $this->t('Newsletter sending finished'));
     // @todo test sent subscriber count.
     // Verify mails.
     $mails = $this->getMails();
-    $this->assertEqual(5, count($mails), t('All mails were sent.'));
+    $this->assertEqual(5, count($mails), $this->t('All mails were sent.'));
     foreach ($mails as $mail) {
-      $this->assertEqual($mail['subject'], '[Default newsletter] ' . $edit['title[0][value]'], t('Mail has correct subject'));
-      $this->assertTrue(isset($this->subscribers[$mail['to']]), t('Found valid recipient'));
+      $this->assertEqual($mail['subject'], '[Default newsletter] ' . $edit['title[0][value]'], $this->t('Mail has correct subject'));
+      $this->assertTrue(isset($this->subscribers[$mail['to']]), $this->t('Found valid recipient'));
       unset($this->subscribers[$mail['to']]);
     }
-    $this->assertEqual(0, count($this->subscribers), t('all subscribers have been received a mail'));
+    $this->assertEqual(0, count($this->subscribers), $this->t('all subscribers have been received a mail'));
   }
 
   /**
@@ -406,17 +406,17 @@ class SimplenewsSendTest extends SimplenewsTestBase {
   public function testUpdateNewsletter() {
     // Create a second newsletter.
     $this->drupalGet('admin/config/services/simplenews');
-    $this->clickLink(t('Add newsletter'));
+    $this->clickLink($this->t('Add newsletter'));
     $edit = [
       'name' => $this->randomString(10),
       'id' => strtolower($this->randomMachineName(10)),
       'description' => $this->randomString(20),
     ];
-    $this->drupalPostForm(NULL, $edit, t('Save'));
-    $this->assertText(t('Newsletter @name has been added', ['@name' => $edit['name']]));
+    $this->drupalPostForm(NULL, $edit, $this->t('Save'));
+    $this->assertText($this->t('Newsletter @name has been added', ['@name' => $edit['name']]));
 
     $this->drupalGet('node/add/simplenews_issue');
-    $this->assertText(t('Create Newsletter Issue'));
+    $this->assertText($this->t('Create Newsletter Issue'));
 
     $first_newsletter_id = $this->getRandomNewsletter();
 
@@ -430,24 +430,24 @@ class SimplenewsSendTest extends SimplenewsTestBase {
     // Verify newsletter.
     \Drupal::entityTypeManager()->getStorage('node')->resetCache();
     $node = Node::load($matches[1]);
-    $this->assertEqual(SIMPLENEWS_STATUS_SEND_NOT, $node->simplenews_issue->status, t('Newsletter sending not started.'));
+    $this->assertEqual(SIMPLENEWS_STATUS_SEND_NOT, $node->simplenews_issue->status, $this->t('Newsletter sending not started.'));
     $this->assertEqual($first_newsletter_id, $node->simplenews_issue->target_id);
 
     do {
       $second_newsletter_id = $this->getRandomNewsletter();
     } while ($first_newsletter_id == $second_newsletter_id);
 
-    $this->clickLink(t('Edit'));
+    $this->clickLink($this->t('Edit'));
     $update = [
       'simplenews_issue[target_id]' => $second_newsletter_id,
     ];
-    $this->drupalPostForm(NULL, $update, t('Save'));
+    $this->drupalPostForm(NULL, $update, $this->t('Save'));
 
     // Verify newsletter.
     \Drupal::entityTypeManager()->getStorage('node')->resetCache();
     $node = Node::load($node->id());
-    $this->assertEqual(SIMPLENEWS_STATUS_SEND_NOT, $node->simplenews_issue->status, t('Newsletter sending not started.'));
-    $this->assertEqual($second_newsletter_id, $node->simplenews_issue->target_id, t('Newsletter has newsletter_id @id.', ['@id' => $second_newsletter_id]));
+    $this->assertEqual(SIMPLENEWS_STATUS_SEND_NOT, $node->simplenews_issue->status, $this->t('Newsletter sending not started.'));
+    $this->assertEqual($second_newsletter_id, $node->simplenews_issue->target_id, $this->t('Newsletter has newsletter_id @id.', ['@id' => $second_newsletter_id]));
   }
 
   /**
@@ -471,10 +471,10 @@ class SimplenewsSendTest extends SimplenewsTestBase {
     simplenews_cron();
 
     // Check there is no error message.
-    $this->assertEqual(count(\Drupal::messenger()->messagesByType(MessengerInterface::TYPE_ERROR)), 0, t('No error messages printed'));
+    $this->assertEqual(count(\Drupal::messenger()->messagesByType(MessengerInterface::TYPE_ERROR)), 0, $this->t('No error messages printed'));
 
     // Check the status on the newsletter tab.  The pending mail should be
-    // retried
+    // retried.
     $this->drupalGet('node/1/simplenews');
     $this->assertText('Newsletter issue is pending, 0 mails sent out of 5, 1 errors.');
 
@@ -493,7 +493,7 @@ class SimplenewsSendTest extends SimplenewsTestBase {
   public function testDelete() {
     // Verify that the newsletter settings are shown.
     $this->drupalGet('node/add/simplenews_issue');
-    $this->assertText(t('Create Newsletter Issue'));
+    $this->assertText($this->t('Create Newsletter Issue'));
 
     // Prevent deleting the mail spool entries automatically.
     $config = $this->config('simplenews.settings');
@@ -508,29 +508,29 @@ class SimplenewsSendTest extends SimplenewsTestBase {
     $this->assertEqual(1, preg_match('|node/(\d+)$|', $this->getUrl(), $matches), 'Node created');
     $node = Node::load($matches[1]);
 
-    $this->clickLink(t('Newsletter'));
-    $this->assertText(t('Send'));
-    $this->assertText(t('Test'));
+    $this->clickLink($this->t('Newsletter'));
+    $this->assertText($this->t('Send'));
+    $this->assertText($this->t('Test'));
 
     // Verify state.
     \Drupal::entityTypeManager()->getStorage('node')->resetCache();
     $node = Node::load($node->id());
-    $this->assertEqual(SIMPLENEWS_STATUS_SEND_NOT, $node->simplenews_issue->status, t('Newsletter not sent yet.'));
+    $this->assertEqual(SIMPLENEWS_STATUS_SEND_NOT, $node->simplenews_issue->status, $this->t('Newsletter not sent yet.'));
 
     // Send now.
-    $this->drupalPostForm(NULL, [], t('Send now'));
+    $this->drupalPostForm(NULL, [], $this->t('Send now'));
 
     // Verify state.
     \Drupal::entityTypeManager()->getStorage('node')->resetCache();
     $node = Node::load($node->id());
-    $this->assertEqual(SIMPLENEWS_STATUS_SEND_PENDING, $node->simplenews_issue->status, t('Newsletter sending pending.'));
+    $this->assertEqual(SIMPLENEWS_STATUS_SEND_PENDING, $node->simplenews_issue->status, $this->t('Newsletter sending pending.'));
 
     $spooled = \Drupal::database()->query('SELECT COUNT(*) FROM {simplenews_mail_spool} WHERE entity_id = :nid AND entity_type = :type', [':nid' => $node->id(), ':type' => 'node'])->fetchField();
-    $this->assertEqual(5, $spooled, t('5 mails remaining in spool.'));
+    $this->assertEqual(5, $spooled, $this->t('5 mails remaining in spool.'));
 
     // Verify that deleting isn't possible right now.
-    $this->clickLink(t('Edit'));
-    $this->assertNoText(t('Delete'));
+    $this->clickLink($this->t('Edit'));
+    $this->assertNoText($this->t('Delete'));
 
     // Send mails.
     simplenews_cron();
@@ -538,20 +538,20 @@ class SimplenewsSendTest extends SimplenewsTestBase {
     // Verify state.
     \Drupal::entityTypeManager()->getStorage('node')->resetCache();
     $node = Node::load($node->id());
-    $this->assertEqual(SIMPLENEWS_STATUS_SEND_READY, $node->simplenews_issue->status, t('Newsletter sending finished'));
+    $this->assertEqual(SIMPLENEWS_STATUS_SEND_READY, $node->simplenews_issue->status, $this->t('Newsletter sending finished'));
 
     $spooled = \Drupal::database()->query('SELECT COUNT(*) FROM {simplenews_mail_spool} WHERE entity_id = :nid AND entity_type = :type', [':nid' => $node->id(), ':type' => 'node'])->fetchField();
-    $this->assertEqual(5, $spooled, t('Mails are kept in simplenews_mail_spool after being sent.'));
+    $this->assertEqual(5, $spooled, $this->t('Mails are kept in simplenews_mail_spool after being sent.'));
 
     // Verify mails.
     $mails = $this->getMails();
-    $this->assertEqual(5, count($mails), t('All mails were sent.'));
+    $this->assertEqual(5, count($mails), $this->t('All mails were sent.'));
     foreach ($mails as $mail) {
-      $this->assertEqual($mail['subject'], '[Default newsletter] ' . $edit['title[0][value]'], t('Mail has correct subject'));
-      $this->assertTrue(isset($this->subscribers[$mail['to']]), t('Found valid recipient'));
+      $this->assertEqual($mail['subject'], '[Default newsletter] ' . $edit['title[0][value]'], $this->t('Mail has correct subject'));
+      $this->assertTrue(isset($this->subscribers[$mail['to']]), $this->t('Found valid recipient'));
       unset($this->subscribers[$mail['to']]);
     }
-    $this->assertEqual(0, count($this->subscribers), t('all subscribers have received a mail'));
+    $this->assertEqual(0, count($this->subscribers), $this->t('all subscribers have received a mail'));
 
     // Update timestamp to simulate pending lock expiration.
     \Drupal::database()->update('simplenews_mail_spool')
@@ -564,19 +564,19 @@ class SimplenewsSendTest extends SimplenewsTestBase {
     simplenews_cron();
     \Drupal::service('simplenews.spool_storage')->getMails();
     $mails = $this->getMails();
-    $this->assertEqual(5, count($mails), t('No additional mails have been sent.'));
+    $this->assertEqual(5, count($mails), $this->t('No additional mails have been sent.'));
 
     // Now delete.
     \Drupal::entityTypeManager()->getStorage('node')->resetCache();
     $this->drupalGet($node->toUrl('edit-form'));
-    $this->clickLink(t('Delete'));
-    $this->drupalPostForm(NULL, [], t('Delete'));
+    $this->clickLink($this->t('Delete'));
+    $this->drupalPostForm(NULL, [], $this->t('Delete'));
 
     // Verify.
     \Drupal::entityTypeManager()->getStorage('node')->resetCache();
     $this->assertEmpty(Node::load($node->id()));
     $spooled = \Drupal::database()->query('SELECT COUNT(*) FROM {simplenews_mail_spool} WHERE entity_id = :nid AND entity_type = :type', [':nid' => $node->id(), ':type' => 'node'])->fetchField();
-    $this->assertEqual(0, $spooled, t('No mails remaining in spool.'));
+    $this->assertEqual(0, $spooled, $this->t('No mails remaining in spool.'));
   }
 
   /**
diff --git a/tests/src/Functional/SimplenewsSourceTest.php b/tests/src/Functional/SimplenewsSourceTest.php
index c036304..3754f9d 100644
--- a/tests/src/Functional/SimplenewsSourceTest.php
+++ b/tests/src/Functional/SimplenewsSourceTest.php
@@ -158,7 +158,7 @@ class SimplenewsSourceTest extends SimplenewsTestBase {
       // Make sure the body is only attached once.
       $this->assertEqual(1, preg_match_all('/Mail token/', $mail['body'], $matches));
 
-      $this->assertTrue(strpos($mail['body'], (string) t('Unsubscribe from this newsletter')) !== FALSE);
+      $this->assertTrue(strpos($mail['body'], (string) $this->t('Unsubscribe from this newsletter')) !== FALSE);
       // Make sure the mail has the correct unsubscribe hash.
       $hash = simplenews_generate_hash($mail['to'], 'remove');
       $this->assertTrue(strpos($mail['body'], $hash) !== FALSE, 'Correct hash is used');
@@ -166,7 +166,7 @@ class SimplenewsSourceTest extends SimplenewsTestBase {
     }
 
     // Report time. @todo: Find a way to actually do some assertions here.
-    $this->pass(t('Mails have been sent in @sec seconds with build caching enabled.', ['@sec' => round($after - $before, 3)]));
+    $this->pass($this->t('Mails have been sent in @sec seconds with build caching enabled.', ['@sec' => round($after - $before, 3)]));
   }
 
   /**
@@ -182,7 +182,7 @@ class SimplenewsSourceTest extends SimplenewsTestBase {
 
     // Set the format to HTML.
     $this->drupalGet('admin/config/services/simplenews');
-    $this->clickLink(t('Edit'));
+    $this->clickLink($this->t('Edit'));
     $edit_newsletter = [
       'format' => 'html',
       // Use umlaut to provoke mime encoding.
@@ -193,8 +193,8 @@ class SimplenewsSourceTest extends SimplenewsTestBase {
       // Request a confirmation receipt.
       'receipt' => TRUE,
     ];
-    $this->drupalPostForm(NULL, $edit_newsletter, t('Save'));
-    $this->clickLink(t('Edit'));
+    $this->drupalPostForm(NULL, $edit_newsletter, $this->t('Save'));
+    $this->clickLink($this->t('Edit'));
 
     $edit = [
       // Always use a character that is escaped.
@@ -268,13 +268,13 @@ class SimplenewsSourceTest extends SimplenewsTestBase {
 
     // Set the format to HTML.
     $this->drupalGet('admin/config/services/simplenews');
-    $this->clickLink(t('Edit'));
+    $this->clickLink($this->t('Edit'));
     $edit = [
       'opt_inout' => 'hidden',
       // @todo: This shouldn't be necessary.
       'from_address' => $this->randomEmail(),
     ];
-    $this->drupalPostForm(NULL, $edit, t('Save'));
+    $this->drupalPostForm(NULL, $edit, $this->t('Save'));
 
     $edit = [
       'title[0][value]' => $this->randomString(10),
@@ -296,7 +296,7 @@ class SimplenewsSourceTest extends SimplenewsTestBase {
     // Test that tokens are correctly replaced.
     foreach (array_slice($this->getMails(), 0, 3) as $mail) {
       // Verify the unsubscribe link is not displayed for hidden newsletters.
-      $this->assertFalse(strpos($mail['body'], (string) t('Unsubscribe from this newsletter')));
+      $this->assertFalse(strpos($mail['body'], (string) $this->t('Unsubscribe from this newsletter')));
     }
   }
 
@@ -348,7 +348,7 @@ class SimplenewsSourceTest extends SimplenewsTestBase {
     }
 
     // Report time. @todo: Find a way to actually do some assertions here.
-    $this->pass(t('Mails have been sent in @sec seconds with caching disabled.', ['@sec' => round($after - $before, 3)]));
+    $this->pass($this->t('Mails have been sent in @sec seconds with caching disabled.', ['@sec' => round($after - $before, 3)]));
   }
 
   /**
diff --git a/tests/src/Functional/SimplenewsSubscribeTest.php b/tests/src/Functional/SimplenewsSubscribeTest.php
index 108f394..7bd4b4f 100644
--- a/tests/src/Functional/SimplenewsSubscribeTest.php
+++ b/tests/src/Functional/SimplenewsSubscribeTest.php
@@ -33,7 +33,7 @@ class SimplenewsSubscribeTest extends SimplenewsTestBase {
 
     $this->drupalGet('admin/config/services/simplenews');
     for ($i = 0; $i < 5; $i++) {
-      $this->clickLink(t('Add newsletter'));
+      $this->clickLink($this->t('Add newsletter'));
       $name = $this->randomMachineName();
       $edit = [
         'name' => $name,
@@ -41,7 +41,7 @@ class SimplenewsSubscribeTest extends SimplenewsTestBase {
         'description' => $this->randomString(20),
         'opt_inout' => 'double',
       ];
-      $this->drupalPostForm(NULL, $edit, t('Save'));
+      $this->drupalPostForm(NULL, $edit, $this->t('Save'));
     }
 
     $newsletters = simplenews_newsletter_get_all();
@@ -57,12 +57,12 @@ class SimplenewsSubscribeTest extends SimplenewsTestBase {
     foreach ($enable as $newsletter_id) {
       $edit['subscriptions[' . $newsletter_id . ']'] = TRUE;
     }
-    $this->drupalPostForm('newsletter/subscriptions', $edit, t('Subscribe'));
-    $this->assertText(t('You will receive a confirmation e-mail shortly containing further instructions on how to complete your subscription.'));
+    $this->drupalPostForm('newsletter/subscriptions', $edit, $this->t('Subscribe'));
+    $this->assertText($this->t('You will receive a confirmation e-mail shortly containing further instructions on how to complete your subscription.'));
 
     // Verify listed changes.
     foreach ($newsletters as $newsletter_id => $newsletter) {
-      $this->assertMailText(t('Subscribe to @name', ['@name' => $newsletter->name]), 0, in_array($newsletter_id, $enable));
+      $this->assertMailText($this->t('Subscribe to @name', ['@name' => $newsletter->name]), 0, in_array($newsletter_id, $enable));
     }
 
     $mails = $this->getMails();
@@ -72,20 +72,20 @@ class SimplenewsSubscribeTest extends SimplenewsTestBase {
     $confirm_url = $this->extractConfirmationLink($this->getMail(0));
 
     $this->drupalGet($confirm_url);
-    $this->assertRaw(t('Are you sure you want to confirm the following subscription changes for %user?', ['%user' => simplenews_mask_mail($mail)]));
+    $this->assertRaw($this->t('Are you sure you want to confirm the following subscription changes for %user?', ['%user' => simplenews_mask_mail($mail)]));
 
     // Verify listed changes.
     foreach ($newsletters as $newsletter_id => $newsletter) {
       if (in_array($newsletter_id, $enable)) {
-        $this->assertText(t('Subscribe to @name', ['@name' => $newsletter->name]));
+        $this->assertText($this->t('Subscribe to @name', ['@name' => $newsletter->name]));
       }
       else {
-        $this->assertNoText(t('Subscribe to @name', ['@name' => $newsletter->name]));
+        $this->assertNoText($this->t('Subscribe to @name', ['@name' => $newsletter->name]));
       }
     }
 
-    $this->drupalPostForm($confirm_url, [], t('Confirm'));
-    $this->assertRaw(t('Subscription changes confirmed for %user.', ['%user' => $mail]));
+    $this->drupalPostForm($confirm_url, [], $this->t('Confirm'));
+    $this->assertRaw($this->t('Subscription changes confirmed for %user.', ['%user' => $mail]));
 
     /** @var \Drupal\simplenews\Subscription\SubscriptionManagerInterface $subscription_manager */
     $subscription_manager = \Drupal::service('simplenews.subscription_manager');
@@ -111,9 +111,9 @@ class SimplenewsSubscribeTest extends SimplenewsTestBase {
     // Go to the manage page and submit without changes.
     $subscriber = Subscriber::loadByMail($mail);
     $hash = simplenews_generate_hash($subscriber->getMail(), 'manage');
-    $this->drupalPostForm('newsletter/subscriptions/' . $subscriber->id() . '/' . REQUEST_TIME . '/' . $hash, [], t('Update'));
-    $this->assertText(t('The newsletter subscriptions for @mail have been updated.', ['@mail' => $mail]));
-    $this->assertEquals(1, count($this->getMails()), t('No confirmation mails have been sent.'));
+    $this->drupalPostForm('newsletter/subscriptions/' . $subscriber->id() . '/' . REQUEST_TIME . '/' . $hash, [], $this->t('Update'));
+    $this->assertText($this->t('The newsletter subscriptions for @mail have been updated.', ['@mail' => $mail]));
+    $this->assertEquals(1, count($this->getMails()), $this->t('No confirmation mails have been sent.'));
 
     // Unsubscribe from two of the three enabled newsletters.
     $disable = array_rand(array_flip($enable), 2);
@@ -124,8 +124,8 @@ class SimplenewsSubscribeTest extends SimplenewsTestBase {
     foreach ($disable as $newsletter_id) {
       $edit['subscriptions[' . $newsletter_id . ']'] = TRUE;
     }
-    $this->drupalPostForm('newsletter/subscriptions', $edit, t('Unsubscribe'));
-    $this->assertText(t('You will receive a confirmation e-mail shortly containing further instructions on how to cancel your subscription.'));
+    $this->drupalPostForm('newsletter/subscriptions', $edit, $this->t('Unsubscribe'));
+    $this->assertText($this->t('You will receive a confirmation e-mail shortly containing further instructions on how to cancel your subscription.'));
 
     // Unsubscribe with no confirmed email.
     $subscription_manager = \Drupal::service('simplenews.subscription_manager');
@@ -139,26 +139,26 @@ class SimplenewsSubscribeTest extends SimplenewsTestBase {
 
     // Verify listed changes.
     foreach ($newsletters as $newsletter_id => $newsletter) {
-      $this->assertMailText(t('Unsubscribe from @name', ['@name' => $newsletter->name]), 1, in_array($newsletter_id, $disable));
+      $this->assertMailText($this->t('Unsubscribe from @name', ['@name' => $newsletter->name]), 1, in_array($newsletter_id, $disable));
     }
 
     $confirm_url = $this->extractConfirmationLink($this->getMail(1));
 
     $this->drupalGet($confirm_url);
-    $this->assertRaw(t('Are you sure you want to confirm the following subscription changes for %user?', ['%user' => simplenews_mask_mail($mail)]));
+    $this->assertRaw($this->t('Are you sure you want to confirm the following subscription changes for %user?', ['%user' => simplenews_mask_mail($mail)]));
 
     // Verify listed changes.
     foreach ($newsletters as $newsletter_id => $newsletter) {
       if (in_array($newsletter_id, $disable)) {
-        $this->assertText(t('Unsubscribe from @name', ['@name' => $newsletter->name]));
+        $this->assertText($this->t('Unsubscribe from @name', ['@name' => $newsletter->name]));
       }
       else {
-        $this->assertNoText(t('Unsubscribe from @name', ['@name' => $newsletter->name]));
+        $this->assertNoText($this->t('Unsubscribe from @name', ['@name' => $newsletter->name]));
       }
     }
 
-    $this->drupalPostForm($confirm_url, [], t('Confirm'));
-    $this->assertRaw(t('Subscription changes confirmed for %user.', ['%user' => $mail]));
+    $this->drupalPostForm($confirm_url, [], $this->t('Confirm'));
+    $this->assertRaw($this->t('Subscription changes confirmed for %user.', ['%user' => $mail]));
 
     // Verify subscription changes.
     $subscriber_storage->resetCache();
@@ -180,7 +180,7 @@ class SimplenewsSubscribeTest extends SimplenewsTestBase {
       'mail[0][value]' => $mail,
       'subscriptions[' . $newsletter_id . ']' => TRUE,
     ];
-    $this->drupalPostForm('newsletter/subscriptions', $edit, t('Subscribe'));
+    $this->drupalPostForm('newsletter/subscriptions', $edit, $this->t('Subscribe'));
     $this->getMail(2);
 
     // Load simplenews settings config object.
@@ -193,7 +193,7 @@ class SimplenewsSubscribeTest extends SimplenewsTestBase {
       'mail[0][value]' => $mail,
       'subscriptions[' . $newsletter_id . ']' => TRUE,
     ];
-    $this->drupalPostForm('newsletter/subscriptions', $edit, t('Subscribe'));
+    $this->drupalPostForm('newsletter/subscriptions', $edit, $this->t('Subscribe'));
     $this->getMail(3);
 
     // Change behavior to never, should send two separate mails.
@@ -205,8 +205,8 @@ class SimplenewsSubscribeTest extends SimplenewsTestBase {
     foreach ($disable as $newsletter_id) {
       $edit['subscriptions[' . $newsletter_id . ']'] = TRUE;
     }
-    $this->drupalPostForm('newsletter/subscriptions', $edit, t('Subscribe'));
-    $this->assertText(t('You will receive a confirmation e-mail shortly containing further instructions on how to complete your subscription.'));
+    $this->drupalPostForm('newsletter/subscriptions', $edit, $this->t('Subscribe'));
+    $this->assertText($this->t('You will receive a confirmation e-mail shortly containing further instructions on how to complete your subscription.'));
     $this->extractConfirmationLink($this->getMail(4));
     $this->extractConfirmationLink($this->getMail(5));
 
@@ -219,13 +219,13 @@ class SimplenewsSubscribeTest extends SimplenewsTestBase {
     foreach (array_keys($newsletters) as $newsletter_id) {
       $edit['subscriptions[' . $newsletter_id . ']'] = TRUE;
     }
-    $this->drupalPostForm('newsletter/subscriptions', $edit, t('Unsubscribe'));
-    $this->assertText(t('You will receive a confirmation e-mail shortly containing further instructions on how to cancel your subscription.'));
+    $this->drupalPostForm('newsletter/subscriptions', $edit, $this->t('Unsubscribe'));
+    $this->assertText($this->t('You will receive a confirmation e-mail shortly containing further instructions on how to cancel your subscription.'));
 
     $confirm_url = $this->extractConfirmationLink($this->getMail(6));
     $this->drupalGet($confirm_url);
     $this->drupalGet($confirm_url . '/ok');
-    $this->assertRaw(t('Subscription changes confirmed for %user.', ['%user' => $mail]));
+    $this->assertRaw($this->t('Subscription changes confirmed for %user.', ['%user' => $mail]));
 
     // Verify subscription changes.
     $subscriber_storage->resetCache();
@@ -238,12 +238,12 @@ class SimplenewsSubscribeTest extends SimplenewsTestBase {
     // Using direct url.
     $this->drupalGet($confirm_url . '/ok');
     $this->assertSession()->statusCodeNotEquals(404);
-    $this->assertRaw(t('All changes to your subscriptions where already applied. No changes made.'));
+    $this->assertRaw($this->t('All changes to your subscriptions where already applied. No changes made.'));
 
     // Using confirmation page.
     $this->drupalGet($confirm_url);
     $this->assertSession()->statusCodeNotEquals(404);
-    $this->assertRaw(t('All changes to your subscriptions where already applied. No changes made.'));
+    $this->assertRaw($this->t('All changes to your subscriptions where already applied. No changes made.'));
 
     // Test expired confirmation links.
     $enable = array_rand($newsletters, 3);
@@ -255,38 +255,38 @@ class SimplenewsSubscribeTest extends SimplenewsTestBase {
     foreach ($enable as $newsletter_id) {
       $edit['subscriptions[' . $newsletter_id . ']'] = TRUE;
     }
-    $this->drupalPostForm('newsletter/subscriptions', $edit, t('Subscribe'));
+    $this->drupalPostForm('newsletter/subscriptions', $edit, $this->t('Subscribe'));
 
     $subscriber = Subscriber::loadByMail($mail);
     $expired_timestamp = REQUEST_TIME - 86401;
     $hash = simplenews_generate_hash($subscriber->getMail(), 'combined' . serialize($subscriber->getChanges()), $expired_timestamp);
     $url = 'newsletter/confirm/combined/' . $subscriber->id() . '/' . $expired_timestamp . '/' . $hash;
     $this->drupalGet($url);
-    $this->assertText(t('This link has expired.'));
-    $this->drupalPostForm(NULL, [], t('Request new confirmation mail'));
+    $this->assertText($this->t('This link has expired.'));
+    $this->drupalPostForm(NULL, [], $this->t('Request new confirmation mail'));
 
     $confirm_url = $this->extractConfirmationLink($this->getMail(8));
 
     // Verify listed changes.
     foreach ($newsletters as $newsletter_id => $newsletter) {
-      $this->assertMailText(t('Subscribe to @name', ['@name' => $newsletter->name]), 8, in_array($newsletter_id, $enable));
+      $this->assertMailText($this->t('Subscribe to @name', ['@name' => $newsletter->name]), 8, in_array($newsletter_id, $enable));
     }
 
     $this->drupalGet($confirm_url);
-    $this->assertRaw(t('Are you sure you want to confirm the following subscription changes for %user?', ['%user' => simplenews_mask_mail($mail)]));
+    $this->assertRaw($this->t('Are you sure you want to confirm the following subscription changes for %user?', ['%user' => simplenews_mask_mail($mail)]));
 
     // Verify listed changes.
     foreach ($newsletters as $newsletter_id => $newsletter) {
       if (in_array($newsletter_id, $enable)) {
-        $this->assertText(t('Subscribe to @name', ['@name' => $newsletter->name]));
+        $this->assertText($this->t('Subscribe to @name', ['@name' => $newsletter->name]));
       }
       else {
-        $this->assertNoText(t('Subscribe to @name', ['@name' => $newsletter->name]));
+        $this->assertNoText($this->t('Subscribe to @name', ['@name' => $newsletter->name]));
       }
     }
 
-    $this->drupalPostForm($confirm_url, [], t('Confirm'));
-    $this->assertRaw(t('Subscription changes confirmed for %user.', ['%user' => $mail]));
+    $this->drupalPostForm($confirm_url, [], $this->t('Confirm'));
+    $this->assertRaw($this->t('Subscription changes confirmed for %user.', ['%user' => $mail]));
   }
 
   /**
@@ -301,7 +301,7 @@ class SimplenewsSubscribeTest extends SimplenewsTestBase {
       return FALSE;
     }
     $confirm_url = $match[0];
-    $this->pass(t('Confirmation URL found: @url', ['@url' => $confirm_url]));
+    $this->pass($this->t('Confirmation URL found: @url', ['@url' => $confirm_url]));
     return $confirm_url;
   }
 
@@ -334,7 +334,7 @@ class SimplenewsSubscribeTest extends SimplenewsTestBase {
     // Create some newsletters for multi-sign up block.
     $this->drupalGet('admin/config/services/simplenews');
     for ($i = 0; $i < 5; $i++) {
-      $this->clickLink(t('Add newsletter'));
+      $this->clickLink($this->t('Add newsletter'));
       $name = $this->randomMachineName();
       $edit = [
         'name' => $name,
@@ -342,7 +342,7 @@ class SimplenewsSubscribeTest extends SimplenewsTestBase {
         'description' => $this->randomString(20),
         'opt_inout' => 'double',
       ];
-      $this->drupalPostForm(NULL, $edit, t('Save'));
+      $this->drupalPostForm(NULL, $edit, $this->t('Save'));
     }
 
     $newsletter_id = $this->getRandomNewsletter();
@@ -371,29 +371,29 @@ class SimplenewsSubscribeTest extends SimplenewsTestBase {
     $edit = [
       'mail[0][value]' => $mail,
     ];
-    $this->drupalPostForm('', $edit, t('Subscribe'));
-    $this->assertText(t('The email address @mail is not valid', ['@mail' => $mail]));
+    $this->drupalPostForm('', $edit, $this->t('Subscribe'));
+    $this->assertText($this->t('The email address @mail is not valid', ['@mail' => $mail]));
 
     // Now with valid email.
     $mail = $this->randomEmail(8);
     $edit = [
       'mail[0][value]' => $mail,
     ];
-    $this->drupalPostForm('', $edit, t('Subscribe'));
-    $this->assertText(t('You will receive a confirmation e-mail shortly containing further instructions on how to complete your subscription.'));
+    $this->drupalPostForm('', $edit, $this->t('Subscribe'));
+    $this->assertText($this->t('You will receive a confirmation e-mail shortly containing further instructions on how to complete your subscription.'));
 
     $subscriber = Subscriber::loadByMail($mail);
     $this->assertNotNull($subscriber, 'New subscriber entity successfully loaded.');
     $subscription = $subscriber->getSubscription($newsletter_id);
-    $this->assertEquals(SIMPLENEWS_SUBSCRIPTION_STATUS_UNCONFIRMED, $subscription->status, t('Subscription is unconfirmed'));
+    $this->assertEquals(SIMPLENEWS_SUBSCRIPTION_STATUS_UNCONFIRMED, $subscription->status, $this->t('Subscription is unconfirmed'));
     $confirm_url = $this->extractConfirmationLink($this->getMail(0));
 
     $this->drupalGet($confirm_url);
     $newsletter = Newsletter::load($newsletter_id);
-    $this->assertRaw(t('Are you sure you want to add %user to the %newsletter mailing list?', ['%user' => simplenews_mask_mail($mail), '%newsletter' => $newsletter->name]));
+    $this->assertRaw($this->t('Are you sure you want to add %user to the %newsletter mailing list?', ['%user' => simplenews_mask_mail($mail), '%newsletter' => $newsletter->name]));
 
-    $this->drupalPostForm(NULL, [], t('Subscribe'));
-    $this->assertRaw(t('%user was added to the %newsletter mailing list.', ['%user' => $mail, '%newsletter' => $newsletter->name]));
+    $this->drupalPostForm(NULL, [], $this->t('Subscribe'));
+    $this->assertRaw($this->t('%user was added to the %newsletter mailing list.', ['%user' => $mail, '%newsletter' => $newsletter->name]));
     $this->assertUrl(new Url('<front>'));
 
     // Test that it is possible to register with a mail address that is already
@@ -410,10 +410,10 @@ class SimplenewsSubscribeTest extends SimplenewsTestBase {
       'pass[pass1]' => $pass,
       'pass[pass2]' => $pass,
     ];
-    $this->drupalPostForm('user/register', $edit, t('Create new account'));
+    $this->drupalPostForm('user/register', $edit, $this->t('Create new account'));
 
     // Verify confirmation messages.
-    $this->assertText(t('Registration successful. You are now logged in.'));
+    $this->assertText($this->t('Registration successful. You are now logged in.'));
 
     // Verify that the subscriber has been updated and references to the correct
     // user.
@@ -441,17 +441,17 @@ class SimplenewsSubscribeTest extends SimplenewsTestBase {
       "subscriptions[$newsletter_id]" => '1',
       'mail[0][value]' => $mail,
     ];
-    $this->drupalPostForm('newsletter/subscriptions', $edit, t('Subscribe'));
-    $this->assertText(t('You will receive a confirmation e-mail shortly containing further instructions on how to complete your subscription.'));
+    $this->drupalPostForm('newsletter/subscriptions', $edit, $this->t('Subscribe'));
+    $this->assertText($this->t('You will receive a confirmation e-mail shortly containing further instructions on how to complete your subscription.'));
 
     $confirm_url = $this->extractConfirmationLink($this->getMail(2));
 
     $this->drupalGet($confirm_url);
     $newsletter = Newsletter::load($newsletter_id);
-    $this->assertRaw(t('Are you sure you want to add %user to the %newsletter mailing list?', ['%user' => simplenews_mask_mail($mail), '%newsletter' => $newsletter->name]));
+    $this->assertRaw($this->t('Are you sure you want to add %user to the %newsletter mailing list?', ['%user' => simplenews_mask_mail($mail), '%newsletter' => $newsletter->name]));
 
-    $this->drupalPostForm($confirm_url, [], t('Subscribe'));
-    $this->assertRaw(t('%user was added to the %newsletter mailing list.', ['%user' => $mail, '%newsletter' => $newsletter->name]));
+    $this->drupalPostForm($confirm_url, [], $this->t('Subscribe'));
+    $this->assertRaw($this->t('%user was added to the %newsletter mailing list.', ['%user' => $mail, '%newsletter' => $newsletter->name]));
 
     // 3. Subscribe anonymous via multi block.
     // Setup subscription block with subscription form.
@@ -467,32 +467,32 @@ class SimplenewsSubscribeTest extends SimplenewsTestBase {
     $edit = [
       'mail[0][value]' => $mail,
     ];
-    $this->drupalPostForm('', $edit, t('Subscribe'));
-    $this->assertText(t('You must select at least one newsletter.'));
+    $this->drupalPostForm('', $edit, $this->t('Subscribe'));
+    $this->assertText($this->t('You must select at least one newsletter.'));
 
     // Now fill out the form and try again. The e-mail should still be listed.
     $edit = [
       'subscriptions[' . $newsletter_id . ']' => TRUE,
     ];
-    $this->drupalPostForm(NULL, $edit, t('Subscribe'));
-    $this->assertText(t('You will receive a confirmation e-mail shortly containing further instructions on how to complete your subscription.'));
+    $this->drupalPostForm(NULL, $edit, $this->t('Subscribe'));
+    $this->assertText($this->t('You will receive a confirmation e-mail shortly containing further instructions on how to complete your subscription.'));
 
     $confirm_url = $this->extractConfirmationLink($this->getMail(3));
 
     $this->drupalGet($confirm_url);
     $newsletter = Newsletter::load($newsletter_id);
-    $this->assertRaw(t('Are you sure you want to add %user to the %newsletter mailing list?', ['%user' => simplenews_mask_mail($mail), '%newsletter' => $newsletter->name]));
+    $this->assertRaw($this->t('Are you sure you want to add %user to the %newsletter mailing list?', ['%user' => simplenews_mask_mail($mail), '%newsletter' => $newsletter->name]));
 
-    $this->drupalPostForm($confirm_url, [], t('Subscribe'));
-    $this->assertRaw(t('%user was added to the %newsletter mailing list.', ['%user' => $mail, '%newsletter' => $newsletter->name]));
+    $this->drupalPostForm($confirm_url, [], $this->t('Subscribe'));
+    $this->assertRaw($this->t('%user was added to the %newsletter mailing list.', ['%user' => $mail, '%newsletter' => $newsletter->name]));
 
     // Try to subscribe again, this should not re-set the status to unconfirmed.
     $edit = [
       'mail[0][value]' => $mail,
       'subscriptions[' . $newsletter_id . ']' => TRUE,
     ];
-    $this->drupalPostForm(NULL, $edit, t('Subscribe'));
-    $this->assertText(t('You will receive a confirmation e-mail shortly containing further instructions on how to complete your subscription.'));
+    $this->drupalPostForm(NULL, $edit, $this->t('Subscribe'));
+    $this->assertText($this->t('You will receive a confirmation e-mail shortly containing further instructions on how to complete your subscription.'));
 
     $subscriber = Subscriber::loadByMail($mail);
     $this->assertNotEqual($subscriber, FALSE, 'New subscriber entity successfully loaded.');
@@ -504,39 +504,39 @@ class SimplenewsSubscribeTest extends SimplenewsTestBase {
     $edit = [
       'mail[0][value]' => $mail,
     ];
-    $this->drupalPostForm('newsletter/subscriptions', $edit, t('Subscribe'));
-    $this->assertText(t('You must select at least one newsletter.'));
+    $this->drupalPostForm('newsletter/subscriptions', $edit, $this->t('Subscribe'));
+    $this->assertText($this->t('You must select at least one newsletter.'));
 
     // Now fill out the form and try again.
     $edit = [
       'subscriptions[' . $newsletter_id . ']' => TRUE,
     ];
-    $this->drupalPostForm(NULL, $edit, t('Subscribe'));
-    $this->assertText(t('You will receive a confirmation e-mail shortly containing further instructions on how to complete your subscription.'));
+    $this->drupalPostForm(NULL, $edit, $this->t('Subscribe'));
+    $this->assertText($this->t('You will receive a confirmation e-mail shortly containing further instructions on how to complete your subscription.'));
 
     $confirm_url = $this->extractConfirmationLink($this->getMail(5));
 
     $this->drupalGet($confirm_url);
     $newsletter = Newsletter::load($newsletter_id);
-    $this->assertRaw(t('Are you sure you want to add %user to the %newsletter mailing list?', ['%user' => simplenews_mask_mail($mail), '%newsletter' => $newsletter->name]));
+    $this->assertRaw($this->t('Are you sure you want to add %user to the %newsletter mailing list?', ['%user' => simplenews_mask_mail($mail), '%newsletter' => $newsletter->name]));
 
-    $this->drupalPostForm($confirm_url, [], t('Subscribe'));
-    $this->assertRaw(t('%user was added to the %newsletter mailing list.', ['%user' => $mail, '%newsletter' => $newsletter->name]));
+    $this->drupalPostForm($confirm_url, [], $this->t('Subscribe'));
+    $this->assertRaw($this->t('%user was added to the %newsletter mailing list.', ['%user' => $mail, '%newsletter' => $newsletter->name]));
 
     // Test unsubscribe on newsletter/subscriptions page.
     $edit = [
       'mail[0][value]' => $mail,
     ];
-    $this->drupalPostForm('newsletter/subscriptions', $edit, t('Unsubscribe'));
-    $this->assertText(t('You must select at least one newsletter.'));
+    $this->drupalPostForm('newsletter/subscriptions', $edit, $this->t('Unsubscribe'));
+    $this->assertText($this->t('You must select at least one newsletter.'));
 
     // Now fill out the form and try again.
     $edit = [
       'subscriptions[' . $newsletter_id . ']' => TRUE,
     ];
-    $this->drupalPostForm(NULL, $edit, t('Unsubscribe'));
-    $this->assertText(t('You will receive a confirmation e-mail shortly containing further instructions on how to cancel your subscription.'));
-    $this->assertMailText(t('We have received a request to remove the @mail', ['@mail' => $mail]), 6);
+    $this->drupalPostForm(NULL, $edit, $this->t('Unsubscribe'));
+    $this->assertText($this->t('You will receive a confirmation e-mail shortly containing further instructions on how to cancel your subscription.'));
+    $this->assertMailText($this->t('We have received a request to remove the @mail', ['@mail' => $mail]), 6);
 
     $confirm_url = $this->extractConfirmationLink($this->getMail(6));
 
@@ -546,24 +546,24 @@ class SimplenewsSubscribeTest extends SimplenewsTestBase {
 
     $this->drupalGet($confirm_url);
     $newsletter = Newsletter::load($newsletter_id);
-    $this->assertRaw(t('Are you sure you want to remove %user from the %newsletter mailing list?', ['%user' => simplenews_mask_mail($mail), '%newsletter' => $newsletter->name]));
+    $this->assertRaw($this->t('Are you sure you want to remove %user from the %newsletter mailing list?', ['%user' => simplenews_mask_mail($mail), '%newsletter' => $newsletter->name]));
 
-    $this->drupalPostForm($confirm_url, [], t('Unsubscribe'));
-    $this->assertRaw(t('%user was unsubscribed from the %newsletter mailing list.', ['%user' => $mail, '%newsletter' => $newsletter->name]));
+    $this->drupalPostForm($confirm_url, [], $this->t('Unsubscribe'));
+    $this->assertRaw($this->t('%user was unsubscribed from the %newsletter mailing list.', ['%user' => $mail, '%newsletter' => $newsletter->name]));
 
     // Visit the newsletter/subscriptions page with the hash.
     $subscriber = Subscriber::loadByMail($mail);
 
     $hash = simplenews_generate_hash($subscriber->getMail(), 'manage');
     $this->drupalGet('newsletter/subscriptions/' . $subscriber->id() . '/' . REQUEST_TIME . '/' . $hash);
-    $this->assertText(t('Subscriptions for @mail', ['@mail' => $mail]));
+    $this->assertText($this->t('Subscriptions for @mail', ['@mail' => $mail]));
 
     $edit = [
       'subscriptions[' . $newsletter_id . ']' => TRUE,
     ];
-    $this->drupalPostForm(NULL, $edit, t('Update'));
+    $this->drupalPostForm(NULL, $edit, $this->t('Update'));
 
-    $this->assertText(t('The newsletter subscriptions for @mail have been updated.', ['@mail' => $mail]));
+    $this->assertText($this->t('The newsletter subscriptions for @mail have been updated.', ['@mail' => $mail]));
 
     // Make sure the subscription is confirmed.
     \Drupal::entityTypeManager()->getStorage('simplenews_subscriber')->resetCache();
@@ -584,8 +584,8 @@ class SimplenewsSubscribeTest extends SimplenewsTestBase {
       'mail[0][value]' => $mail,
       'subscriptions[' . $newsletter_id . ']' => TRUE,
     ];
-    $this->drupalPostForm('newsletter/subscriptions', $edit, t('Unsubscribe'));
-    $this->assertText(t('You will receive a confirmation e-mail shortly containing further instructions on how to cancel your subscription.'));
+    $this->drupalPostForm('newsletter/subscriptions', $edit, $this->t('Unsubscribe'));
+    $this->assertText($this->t('You will receive a confirmation e-mail shortly containing further instructions on how to cancel your subscription.'));
     $this->assertMailText('is not subscribed to this mailing list', 7);
 
     // Test expired confirmation links.
@@ -593,24 +593,24 @@ class SimplenewsSubscribeTest extends SimplenewsTestBase {
       'mail[0][value]' => $mail,
       'subscriptions[' . $newsletter_id . ']' => TRUE,
     ];
-    $this->drupalPostForm('newsletter/subscriptions', $edit, t('Subscribe'));
+    $this->drupalPostForm('newsletter/subscriptions', $edit, $this->t('Subscribe'));
 
     $subscriber = Subscriber::loadByMail($mail);
     $expired_timestamp = REQUEST_TIME - 86401;
     $hash = simplenews_generate_hash($subscriber->getMail(), 'add', $expired_timestamp);
     $url = 'newsletter/confirm/add/' . $subscriber->id() . '/' . $newsletter_id . '/' . $expired_timestamp . '/' . $hash;
     $this->drupalGet($url);
-    $this->assertText(t('This link has expired.'));
-    $this->drupalPostForm(NULL, [], t('Request new confirmation mail'));
+    $this->assertText($this->t('This link has expired.'));
+    $this->drupalPostForm(NULL, [], $this->t('Request new confirmation mail'));
 
     $confirm_url = $this->extractConfirmationLink($this->getMail(9));
 
     $this->drupalGet($confirm_url);
     $newsletter = Newsletter::load($newsletter_id);
-    $this->assertRaw(t('Are you sure you want to add %user to the %newsletter mailing list?', ['%user' => simplenews_mask_mail($mail), '%newsletter' => $newsletter->name]));
+    $this->assertRaw($this->t('Are you sure you want to add %user to the %newsletter mailing list?', ['%user' => simplenews_mask_mail($mail), '%newsletter' => $newsletter->name]));
 
-    $this->drupalPostForm($confirm_url, [], t('Subscribe'));
-    $this->assertRaw(t('%user was added to the %newsletter mailing list.', ['%user' => $mail, '%newsletter' => $newsletter->name]));
+    $this->drupalPostForm($confirm_url, [], $this->t('Subscribe'));
+    $this->assertRaw($this->t('%user was added to the %newsletter mailing list.', ['%user' => $mail, '%newsletter' => $newsletter->name]));
 
     // Make sure the subscription is confirmed now.
     \Drupal::entityTypeManager()->getStorage('simplenews_subscriber')->resetCache();
@@ -647,7 +647,7 @@ class SimplenewsSubscribeTest extends SimplenewsTestBase {
     $this->drupalLogin($admin_user);
 
     $this->drupalGet('admin/config/services/simplenews');
-    $this->clickLink(t('Add newsletter'));
+    $this->clickLink($this->t('Add newsletter'));
     $name = $this->randomMachineName();
     $edit = [
       'name' => $name,
@@ -655,7 +655,7 @@ class SimplenewsSubscribeTest extends SimplenewsTestBase {
       'description' => $this->randomString(20),
       'opt_inout' => 'single',
     ];
-    $this->drupalPostForm(NULL, $edit, t('Save'));
+    $this->drupalPostForm(NULL, $edit, $this->t('Save'));
 
     $this->drupalLogout();
 
@@ -676,8 +676,8 @@ class SimplenewsSubscribeTest extends SimplenewsTestBase {
     $edit = [
       'mail[0][value]' => $mail,
     ];
-    $this->drupalPostForm('', $edit, t('Subscribe'));
-    $this->assertText(t('You have been subscribed.'));
+    $this->drupalPostForm('', $edit, $this->t('Subscribe'));
+    $this->assertText($this->t('You have been subscribed.'));
 
     $subscriber = Subscriber::loadByMail($mail);
     $subscription = $subscriber->getSubscription($newsletter_id);
@@ -688,7 +688,7 @@ class SimplenewsSubscribeTest extends SimplenewsTestBase {
       'mail[0][value]' => $mail,
       'subscriptions[' . $newsletter_id . ']' => TRUE,
     ];
-    $this->drupalPostForm('newsletter/subscriptions', $edit, t('Unsubscribe'));
+    $this->drupalPostForm('newsletter/subscriptions', $edit, $this->t('Unsubscribe'));
 
     \Drupal::entityTypeManager()->getStorage('simplenews_subscriber')->resetCache();
     $subscriber = Subscriber::loadByMail($mail);
@@ -729,7 +729,7 @@ class SimplenewsSubscribeTest extends SimplenewsTestBase {
     // Create some newsletters for multi-sign up block.
     $this->drupalGet('admin/config/services/simplenews');
     for ($i = 0; $i < 5; $i++) {
-      $this->clickLink(t('Add newsletter'));
+      $this->clickLink($this->t('Add newsletter'));
       $name = $this->randomMachineName();
       $edit = [
         'name' => $name,
@@ -737,7 +737,7 @@ class SimplenewsSubscribeTest extends SimplenewsTestBase {
         'description' => $this->randomString(20),
         'opt_inout' => 'double',
       ];
-      $this->drupalPostForm(NULL, $edit, t('Save'));
+      $this->drupalPostForm(NULL, $edit, $this->t('Save'));
     }
 
     $newsletter_id = $this->getRandomNewsletter();
@@ -756,8 +756,8 @@ class SimplenewsSubscribeTest extends SimplenewsTestBase {
     // 1. Subscribe authenticated via block
     // Subscribe + submit
     // Assert confirmation message.
-    $this->drupalPostForm(NULL, [], t('Subscribe'));
-    $this->assertText(t('You have been subscribed.'));
+    $this->drupalPostForm(NULL, [], $this->t('Subscribe'));
+    $this->assertText($this->t('You have been subscribed.'));
     $this->assertEqual($this->countSubscribers(), 1);
 
     // 2. Unsubscribe authenticated via subscription page
@@ -766,8 +766,8 @@ class SimplenewsSubscribeTest extends SimplenewsTestBase {
     $edit = [
       "subscriptions[$newsletter_id]" => 0,
     ];
-    $this->drupalPostForm('newsletter/subscriptions', $edit, t('Update'));
-    $this->assertRaw(t('The newsletter subscriptions for %mail have been updated.', ['%mail' => $subscriber_user->getEmail()]));
+    $this->drupalPostForm('newsletter/subscriptions', $edit, $this->t('Update'));
+    $this->assertRaw($this->t('The newsletter subscriptions for %mail have been updated.', ['%mail' => $subscriber_user->getEmail()]));
 
     // 3. Subscribe authenticated via subscription page
     // Subscribe + submit
@@ -776,8 +776,8 @@ class SimplenewsSubscribeTest extends SimplenewsTestBase {
     $edit = [
       "subscriptions[$newsletter_id]" => '1',
     ];
-    $this->drupalPostForm('newsletter/subscriptions', $edit, t('Update'));
-    $this->assertRaw(t('The newsletter subscriptions for %mail have been updated.', ['%mail' => $subscriber_user->getEmail()]));
+    $this->drupalPostForm('newsletter/subscriptions', $edit, $this->t('Update'));
+    $this->assertRaw($this->t('The newsletter subscriptions for %mail have been updated.', ['%mail' => $subscriber_user->getEmail()]));
     $this->assertEqual($this->countSubscribers(), 1);
 
     // 4. Unsubscribe authenticated via account page
@@ -787,12 +787,12 @@ class SimplenewsSubscribeTest extends SimplenewsTestBase {
       "subscriptions[$newsletter_id]" => FALSE,
     ];
     $url = 'user/' . $subscriber_user->id() . '/simplenews';
-    $this->drupalPostForm($url, $edit, t('Save'));
-    $this->assertRaw(t('Your newsletter subscriptions have been updated.', ['%mail' => $subscriber_user->getEmail()]));
+    $this->drupalPostForm($url, $edit, $this->t('Save'));
+    $this->assertRaw($this->t('Your newsletter subscriptions have been updated.', ['%mail' => $subscriber_user->getEmail()]));
 
     $subscriber = Subscriber::loadByMail($subscriber_user->getEmail());
     $subscription = $subscriber->getSubscription($newsletter_id);
-    $this->assertEquals(SIMPLENEWS_SUBSCRIPTION_STATUS_UNSUBSCRIBED, $subscription->status, t('Subscription is unsubscribed'));
+    $this->assertEquals(SIMPLENEWS_SUBSCRIPTION_STATUS_UNSUBSCRIBED, $subscription->status, $this->t('Subscription is unsubscribed'));
 
     // 5. Subscribe authenticated via account page
     // Subscribe + submit
@@ -802,8 +802,8 @@ class SimplenewsSubscribeTest extends SimplenewsTestBase {
       "subscriptions[$newsletter_id]" => '1',
     ];
     $url = 'user/' . $subscriber_user->id() . '/simplenews';
-    $this->drupalPostForm($url, $edit, t('Save'));
-    $this->assertRaw(t('Your newsletter subscriptions have been updated.', ['%mail' => $subscriber_user->getEmail()]));
+    $this->drupalPostForm($url, $edit, $this->t('Save'));
+    $this->assertRaw($this->t('Your newsletter subscriptions have been updated.', ['%mail' => $subscriber_user->getEmail()]));
     $count = 1;
     $this->assertEqual($this->countSubscribers(), $count);
 
@@ -830,8 +830,8 @@ class SimplenewsSubscribeTest extends SimplenewsTestBase {
     $this->assertResponse(200);
 
     $this->assertNoField('mail[0][value]');
-    $this->drupalPostForm(NULL, [], t('Update'));
-    $this->assertText(t('The newsletter subscriptions for @mail have been updated.', ['@mail' => $subscriber_user2->getEmail()]));
+    $this->drupalPostForm(NULL, [], $this->t('Update'));
+    $this->assertText($this->t('The newsletter subscriptions for @mail have been updated.', ['@mail' => $subscriber_user2->getEmail()]));
 
     // Nothing should have happened to subscriptions but this does create a
     // subscriber.
@@ -843,8 +843,8 @@ class SimplenewsSubscribeTest extends SimplenewsTestBase {
     $edit = [
       'subscriptions[' . $newsletter_id . ']' => TRUE,
     ];
-    $this->drupalPostForm(NULL, $edit, t('Update'));
-    $this->assertText(t('The newsletter subscriptions for @mail have been updated.', ['@mail' => $subscriber_user2->getEmail()]));
+    $this->drupalPostForm(NULL, $edit, $this->t('Update'));
+    $this->assertText($this->t('The newsletter subscriptions for @mail have been updated.', ['@mail' => $subscriber_user2->getEmail()]));
     $this->assertEqual($this->countSubscribers(), $count);
 
     $this->assertFieldChecked('edit-subscriptions-' . $newsletter_id);
@@ -853,8 +853,8 @@ class SimplenewsSubscribeTest extends SimplenewsTestBase {
     $edit = [
       'subscriptions[' . $newsletter_id . ']' => FALSE,
     ];
-    $this->drupalPostForm(NULL, $edit, t('Update'));
-    $this->assertText(t('The newsletter subscriptions for @mail have been updated.', ['@mail' => $subscriber_user2->getEmail()]));
+    $this->drupalPostForm(NULL, $edit, $this->t('Update'));
+    $this->assertText($this->t('The newsletter subscriptions for @mail have been updated.', ['@mail' => $subscriber_user2->getEmail()]));
 
     $this->assertNoFieldChecked('edit-subscriptions-' . $newsletter_id);
 
@@ -863,8 +863,8 @@ class SimplenewsSubscribeTest extends SimplenewsTestBase {
     $this->drupalLogin($subscriber_user3);
 
     $this->assertNoField('mail[0][value]');
-    $this->drupalPostForm('newsletter/subscriptions', [], t('Update'));
-    $this->assertText(t('The newsletter subscriptions for @mail have been updated.', ['@mail' => $subscriber_user3->getEmail()]));
+    $this->drupalPostForm('newsletter/subscriptions', [], $this->t('Update'));
+    $this->assertText($this->t('The newsletter subscriptions for @mail have been updated.', ['@mail' => $subscriber_user3->getEmail()]));
 
     // Nothing should have happened to subscriptions but this does create a
     // subscriber.
@@ -876,8 +876,8 @@ class SimplenewsSubscribeTest extends SimplenewsTestBase {
     $edit = [
       'subscriptions[' . $newsletter_id . ']' => TRUE,
     ];
-    $this->drupalPostForm('newsletter/subscriptions', $edit, t('Update'));
-    $this->assertText(t('The newsletter subscriptions for @mail have been updated.', ['@mail' => $subscriber_user3->getEmail()]));
+    $this->drupalPostForm('newsletter/subscriptions', $edit, $this->t('Update'));
+    $this->assertText($this->t('The newsletter subscriptions for @mail have been updated.', ['@mail' => $subscriber_user3->getEmail()]));
     $this->assertEqual($this->countSubscribers(), $count);
 
     $this->assertFieldChecked('edit-subscriptions-' . $newsletter_id);
@@ -886,8 +886,8 @@ class SimplenewsSubscribeTest extends SimplenewsTestBase {
     $edit = [
       'subscriptions[' . $newsletter_id . ']' => FALSE,
     ];
-    $this->drupalPostForm('newsletter/subscriptions', $edit, t('Update'));
-    $this->assertText(t('The newsletter subscriptions for @mail have been updated.', ['@mail' => $subscriber_user3->getEmail()]));
+    $this->drupalPostForm('newsletter/subscriptions', $edit, $this->t('Update'));
+    $this->assertText($this->t('The newsletter subscriptions for @mail have been updated.', ['@mail' => $subscriber_user3->getEmail()]));
 
     $this->assertNoFieldChecked('edit-subscriptions-' . $newsletter_id);
   }
@@ -908,7 +908,7 @@ class SimplenewsSubscribeTest extends SimplenewsTestBase {
       'settings[newsletters][default]' => TRUE,
       'region' => 'header',
     ];
-    $this->drupalPostForm(NULL, $edit, t('Save block'));
+    $this->drupalPostForm(NULL, $edit, $this->t('Save block'));
     $this->drupalGet('');
     // Provided Unique ID is used as form_id.
     $this->assertFieldByXPath("//*[@id=\"simplenews-subscriptions-block-test-simplenews-123\"]", NULL, 'Form ID found and contains expected value.');
@@ -929,8 +929,8 @@ class SimplenewsSubscribeTest extends SimplenewsTestBase {
       "subscriptions[$newsletter_id]" => TRUE,
       'mail[0][value]' => $mail,
     ];
-    $this->drupalPostForm(NULL, $edit, t('Save'));
-    $this->assertText(t('Subscriber @mail has been added.', ['@mail' => $mail]));
+    $this->drupalPostForm(NULL, $edit, $this->t('Save'));
+    $this->assertText($this->t('Subscriber @mail has been added.', ['@mail' => $mail]));
 
     $subscriber = Subscriber::loadByMail($mail);
     $subscription = $subscriber->getSubscription($newsletter_id);
@@ -950,7 +950,7 @@ class SimplenewsSubscribeTest extends SimplenewsTestBase {
     $unsubscribe_url = $this->extractConfirmationLink($this->getMail(0));
     $this->drupalGet($unsubscribe_url);
     $this->assertText('Confirm remove subscription');
-    $this->drupalPostForm(NULL, [], t('Unsubscribe'));
+    $this->drupalPostForm(NULL, [], $this->t('Unsubscribe'));
     $this->assertText('was unsubscribed from the Default newsletter mailing list.');
   }
 
diff --git a/tests/src/Functional/SimplenewsSynchronizeFieldsFormTest.php b/tests/src/Functional/SimplenewsSynchronizeFieldsFormTest.php
index 4403e89..e8e63d1 100644
--- a/tests/src/Functional/SimplenewsSynchronizeFieldsFormTest.php
+++ b/tests/src/Functional/SimplenewsSynchronizeFieldsFormTest.php
@@ -65,7 +65,7 @@ class SimplenewsSynchronizeFieldsFormTest extends SimplenewsTestBase {
     $this->assertRaw($this->user->field_shared->value);
 
     $new_value = $this->randomMachineName();
-    $this->drupalPostForm(NULL, ['field_shared[0][value]' => $new_value], t('Save'));
+    $this->drupalPostForm(NULL, ['field_shared[0][value]' => $new_value], $this->t('Save'));
     $this->drupalGet('admin/people/simplenews/edit/' . $subscriber->id());
     $this->assertRaw($new_value);
 
@@ -73,10 +73,10 @@ class SimplenewsSynchronizeFieldsFormTest extends SimplenewsTestBase {
     $this->assertEqual($this->user->field_shared->value, $new_value);
 
     // Unset the sync setting and assert field is not synced.
-    $this->drupalPostForm('admin/config/people/simplenews/settings/subscriber', ['simplenews_sync_fields' => FALSE], t('Save configuration'));
+    $this->drupalPostForm('admin/config/people/simplenews/settings/subscriber', ['simplenews_sync_fields' => FALSE], $this->t('Save configuration'));
 
     $unsynced_value = $this->randomMachineName();
-    $this->drupalPostForm('admin/people/simplenews/edit/' . $subscriber->id(), ['field_shared[0][value]' => $unsynced_value], t('Save'));
+    $this->drupalPostForm('admin/people/simplenews/edit/' . $subscriber->id(), ['field_shared[0][value]' => $unsynced_value], $this->t('Save'));
     $this->drupalGet('admin/people/simplenews/edit/' . $subscriber->id());
     $this->assertRaw($unsynced_value);
 
diff --git a/tests/src/Functional/SimplenewsTestBase.php b/tests/src/Functional/SimplenewsTestBase.php
index 71e4103..e007e71 100644
--- a/tests/src/Functional/SimplenewsTestBase.php
+++ b/tests/src/Functional/SimplenewsTestBase.php
@@ -99,7 +99,7 @@ abstract class SimplenewsTestBase extends BrowserTestBase {
 
     $settings += [
       'newsletters' => [],
-      'message' => t('Select the newsletter(s) to which you want to subscribe or unsubscribe.'),
+      'message' => $this->t('Select the newsletter(s) to which you want to subscribe or unsubscribe.'),
       'unique_id' => \Drupal::service('uuid')->generate(),
     ];
 
@@ -129,13 +129,13 @@ abstract class SimplenewsTestBase extends BrowserTestBase {
     }
 
     $this->drupalGet('admin/people/simplenews');
-    $this->clickLink(t('Mass subscribe'));
+    $this->clickLink($this->t('Mass subscribe'));
     $edit = [
       'emails' => implode(',', $this->subscribers),
       // @todo: Don't hardcode the default newsletter_id.
       'newsletters[' . $newsletter_id . ']' => TRUE,
     ];
-    $this->drupalPostForm(NULL, $edit, t('Subscribe'));
+    $this->drupalPostForm(NULL, $edit, $this->t('Subscribe'));
   }
 
   /**
@@ -185,7 +185,7 @@ abstract class SimplenewsTestBase extends BrowserTestBase {
    *   (optional) Additional form field values, keyed by form field names.
    * @param string $submit
    *   (optional) The value of the form submit button. Defaults to
-   *   t('Subscribe').
+   *   $this->t('Subscribe').
    * @param string $path
    *   (optional) The path where to expect the form, defaults to
    *   'newsletter/subscriptions'.
@@ -204,7 +204,7 @@ abstract class SimplenewsTestBase extends BrowserTestBase {
     foreach ($newsletter_ids as $newsletter_id) {
       $edit["subscriptions[$newsletter_id]"] = $newsletter_id;
     }
-    $this->drupalPostForm($path, $edit, $submit ?: t('Subscribe'));
+    $this->drupalPostForm($path, $edit, $submit ?: $this->t('Subscribe'));
     $this->assertResponse($response);
   }
 
@@ -224,7 +224,7 @@ abstract class SimplenewsTestBase extends BrowserTestBase {
       'mail' => $email ?: $this->randomEmail(),
       'name' => $this->randomMachineName(),
     ];
-    $this->drupalPostForm('user/register', $edit, t('Create new account'));
+    $this->drupalPostForm('user/register', $edit, $this->t('Create new account'));
     // Return uid of new user.
     $uids = \Drupal::entityQuery('user')
       ->sort('created', 'DESC')
@@ -245,7 +245,7 @@ abstract class SimplenewsTestBase extends BrowserTestBase {
     $uid = $user->id();
     $timestamp = REQUEST_TIME;
     $hash = user_pass_rehash($user, $timestamp);
-    $this->drupalPostForm("/user/reset/$uid/$timestamp/$hash", [], t('Log in'));
+    $this->drupalPostForm("/user/reset/$uid/$timestamp/$hash", [], $this->t('Log in'));
   }
 
   /**
@@ -273,7 +273,7 @@ abstract class SimplenewsTestBase extends BrowserTestBase {
    */
   protected function getMail($offset) {
     $mails = $this->getMails();
-    $this->assertTrue(isset($mails[$offset]), t('Valid mails offset %offset (%count mails sent).', ['%offset' => $offset, '%count' => count($mails)]));
+    $this->assertTrue(isset($mails[$offset]), $this->t('Valid mails offset %offset (%count mails sent).', ['%offset' => $offset, '%count' => count($mails)]));
     return $mails[$offset]['body'];
   }
 
diff --git a/tests/src/Functional/SimplenewsUninstallTest.php b/tests/src/Functional/SimplenewsUninstallTest.php
index 3b1aefa..dbb8ecb 100644
--- a/tests/src/Functional/SimplenewsUninstallTest.php
+++ b/tests/src/Functional/SimplenewsUninstallTest.php
@@ -11,6 +11,8 @@ class SimplenewsUninstallTest extends SimplenewsTestBase {
 
   /**
    * {@inheritdoc}
+   *
+   * @throws \Drupal\Core\Entity\EntityStorageException
    */
   protected function setUp() {
     parent::setUp();
@@ -39,17 +41,17 @@ class SimplenewsUninstallTest extends SimplenewsTestBase {
     $this->drupalCreateNode(['type' => 'simplenews_issue', 'label' => $this->randomMachineName()])->save();
 
     // Delete Simplenews data.
-    $this->drupalPostForm('admin/config/services/simplenews/settings/uninstall', [], t('Delete Simplenews data'));
-    $this->assertText(t('Simplenews data has been deleted.'));
+    $this->drupalPostForm('admin/config/services/simplenews/settings/uninstall', [], $this->t('Delete Simplenews data'));
+    $this->assertText($this->t('Simplenews data has been deleted.'));
 
     // Uninstall the module.
-    $this->drupalPostForm('admin/modules/uninstall', ['uninstall[simplenews]' => TRUE], t('Uninstall'));
-    $this->drupalPostForm(NULL, [], t('Uninstall'));
-    $this->assertText(t('The selected modules have been uninstalled.'));
-    $this->assertNoText(t('Simplenews'));
+    $this->drupalPostForm('admin/modules/uninstall', ['uninstall[simplenews]' => TRUE], $this->t('Uninstall'));
+    $this->drupalPostForm(NULL, [], $this->t('Uninstall'));
+    $this->assertText($this->t('The selected modules have been uninstalled.'));
+    $this->assertNoText($this->t('Simplenews'));
 
     // Make sure that the module can be installed again.
-    $this->drupalPostForm('admin/modules', ['modules[simplenews][enable]' => TRUE], t('Install'));
+    $this->drupalPostForm('admin/modules', ['modules[simplenews][enable]' => TRUE], $this->t('Install'));
     $this->assertText('Module Simplenews has been enabled.');
   }
 
