diff --git a/tests/src/Functional/TfaLoginTest.php b/tests/src/Functional/TfaLoginTest.php
index a21213d..98fb7d5 100644
--- a/tests/src/Functional/TfaLoginTest.php
+++ b/tests/src/Functional/TfaLoginTest.php
@@ -49,9 +49,10 @@ class TfaLoginTest extends TfaTestBase {
     $edit = [
       'tfa_required_roles[' . $web_user_roles[0] . ']' => TRUE,
     ];
-    $this->drupalPostForm('admin/config/people/tfa', $edit, 'Save configuration');
+    $this->drupalGet('admin/config/people/tfa');
+    $this->submitForm($edit, 'Save configuration');
     $assert_session->statusCodeEquals(200);
-    $this->assertText('The configuration options have been saved.');
+    $this->assertSession()->pageTextContains('The configuration options have been saved.');
 
     // Check that tfa is presented.
     $this->drupalLogout();
@@ -59,7 +60,8 @@ class TfaLoginTest extends TfaTestBase {
       'name' => $this->webUser->getAccountName(),
       'pass' => $this->webUser->passRaw,
     ];
-    $this->drupalPostForm('user/login', $edit, 'Log in');
+    $this->drupalGet('user/login');
+    $this->submitForm($edit, 'Log in');
     $assert_session->statusCodeEquals(200);
     $assert_session->addressMatches('/\/tfa\/' . $this->webUser->id() . '/');
 
@@ -73,9 +75,10 @@ class TfaLoginTest extends TfaTestBase {
       $edit['tfa_required_roles[' . $role_id . ']'] = FALSE;
     }
     $edit['tfa_required_roles[authenticated]'] = FALSE;
-    $this->drupalPostForm('admin/config/people/tfa', $edit, 'Save configuration');
+    $this->drupalGet('admin/config/people/tfa');
+    $this->submitForm($edit, 'Save configuration');
     $assert_session->statusCodeEquals(200);
-    $this->assertText('The configuration options have been saved.');
+    $this->assertSession()->pageTextContains('The configuration options have been saved.');
     // Enable tfa for a single user.
     $this->drupalLogin($this->webUser);
     $this->drupalGet('user/' . $this->webUser->id() . '/security/tfa');
@@ -104,7 +107,8 @@ class TfaLoginTest extends TfaTestBase {
       'name' => $this->webUser->getAccountName(),
       'pass' => $this->webUser->passRaw,
     ];
-    $this->drupalPostForm('user/login', $edit, 'Log in');
+    $this->drupalGet('user/login');
+    $this->submitForm($edit, 'Log in');
     $assert_session->statusCodeEquals(200);
     $assert_session->addressMatches('/\/tfa\/' . $this->webUser->id() . '/');
   }
diff --git a/tests/src/Functional/TfaRecoveryCodePluginTest.php b/tests/src/Functional/TfaRecoveryCodePluginTest.php
index 1fe5a67..900f769 100644
--- a/tests/src/Functional/TfaRecoveryCodePluginTest.php
+++ b/tests/src/Functional/TfaRecoveryCodePluginTest.php
@@ -125,7 +125,7 @@ class TfaRecoveryCodePluginTest extends TfaTestBase {
 
     // Make sure codes were saved to the account.
     $codes = $this->validationPlugin->getCodes();
-    $assert->assert(!empty($codes), 'No codes saved to the account data.');
+    $this->assertTrue(!empty($codes), 'No codes saved to the account data.');
 
     // Now the user should be able to see their existing codes. Let's test that.
     $assert->linkExists('Show codes');
@@ -155,7 +155,8 @@ class TfaRecoveryCodePluginTest extends TfaTestBase {
       'name' => $this->userAccount->getAccountName(),
       'pass' => $this->userAccount->passRaw,
     ];
-    $this->drupalPostForm('user/login', $edit, 'Log in');
+    $this->drupalGet('user/login');
+    $this->submitForm($edit, 'Log in');
     $assert->statusCodeEquals(200);
     $assert->pageTextContains('Enter one of your recovery codes');
 
@@ -170,7 +171,7 @@ class TfaRecoveryCodePluginTest extends TfaTestBase {
     $this->submitForm($edit, 'Verify');
     $assert->statusCodeEquals(200);
     $assert->pageTextContains($this->userAccount->getDisplayName());
-    $assert->assert($this->userAccount->isAuthenticated(), 'User is logged in.');
+    $this->assertTrue($this->userAccount->isAuthenticated(), 'User is logged in.');
 
     // Try replay attack with a valid code that has already been used.
     $this->drupalLogout();
@@ -178,7 +179,8 @@ class TfaRecoveryCodePluginTest extends TfaTestBase {
       'name' => $this->userAccount->getAccountName(),
       'pass' => $this->userAccount->passRaw,
     ];
-    $this->drupalPostForm('user/login', $edit, 'Log in');
+    $this->drupalGet('user/login');
+    $this->submitForm($edit, 'Log in');
     $assert->statusCodeEquals(200);
     $assert->pageTextContains('Enter one of your recovery codes');
 
diff --git a/tests/src/Functional/TfaTestBase.php b/tests/src/Functional/TfaTestBase.php
index 0cb4fc8..ffd862d 100644
--- a/tests/src/Functional/TfaTestBase.php
+++ b/tests/src/Functional/TfaTestBase.php
@@ -115,7 +115,7 @@ abstract class TfaTestBase extends BrowserTestBase {
     $select_field_id = 'edit-tfa-validate';
     $option_field = $assert->optionExists($select_field_id, $validation_plugin_id);
     $result = $option_field->hasAttribute('selected');
-    $assert->assert($result, "Option {$validation_plugin_id} for field {$select_field_id} is selected.");
+    $this->assertTrue($result, "Option {$validation_plugin_id} for field {$select_field_id} is selected.");
   }
 
 }
diff --git a/tests/src/Unit/Plugin/TfaValidation/TfaRecoveryCodeTest.php b/tests/src/Unit/Plugin/TfaValidation/TfaRecoveryCodeTest.php
index 462be6c..2b86f79 100644
--- a/tests/src/Unit/Plugin/TfaValidation/TfaRecoveryCodeTest.php
+++ b/tests/src/Unit/Plugin/TfaValidation/TfaRecoveryCodeTest.php
@@ -2,6 +2,7 @@
 
 namespace Drupal\Tests\tfa\Unit\Plugin\TfaValidation;
 
+use Prophecy\PhpUnit\ProphecyTrait;
 use Drupal\Core\Config\ConfigFactoryInterface;
 use Drupal\Core\Config\ImmutableConfig;
 use Drupal\Core\DependencyInjection\ContainerBuilder;
@@ -20,6 +21,7 @@ use Drupal\user\UserDataInterface;
  */
 class TfaRecoveryCodeTest extends UnitTestCase {
 
+  use ProphecyTrait;
   /**
    * Mocked user data service.
    *
diff --git a/tests/src/Unit/TfaContextTest.php b/tests/src/Unit/TfaContextTest.php
index 3a94672..7a9e276 100644
--- a/tests/src/Unit/TfaContextTest.php
+++ b/tests/src/Unit/TfaContextTest.php
@@ -2,6 +2,7 @@
 
 namespace Drupal\Tests\tfa\Unit;
 
+use Prophecy\PhpUnit\ProphecyTrait;
 use Drupal\Core\Config\ConfigFactoryInterface;
 use Drupal\Core\Config\ImmutableConfig;
 use Drupal\Tests\UnitTestCase;
@@ -20,6 +21,7 @@ use Symfony\Component\HttpFoundation\Request;
  */
 class TfaContextTest extends UnitTestCase {
 
+  use ProphecyTrait;
   /**
    * Validation plugin manager.
    *
