diff --git a/factor/email/tests/factor_test.php b/factor/email/tests/factor_test.php
index e61ace97..b7434bfc 100644
--- a/factor/email/tests/factor_test.php
+++ b/factor/email/tests/factor_test.php
@@ -14,8 +14,6 @@
 // You should have received a copy of the GNU General Public License
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
-namespace factor_email\tests;
-
 /**
  * Tests for TOTP factor.
  *
@@ -25,7 +23,7 @@
  * @copyright   Catalyst IT
  * @license     http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
-class factor_test extends \advanced_testcase {
+class email_factor_test extends \core_phpunit\testcase {
 
     /**
      * Provides to test_generate_email_ip_address_location test.
diff --git a/factor/grace/tests/factor_test.php b/factor/grace/tests/factor_test.php
index f5d8b86a..e2137d70 100644
--- a/factor/grace/tests/factor_test.php
+++ b/factor/grace/tests/factor_test.php
@@ -14,8 +14,6 @@
 // You should have received a copy of the GNU General Public License
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
-namespace factor_grace\tests;
-
 /**
  * Tests for grace factor.
  *
@@ -24,7 +22,7 @@
  * @copyright   Catalyst IT
  * @license     http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
-class factor_test extends \advanced_testcase {
+class grace_factor_test extends \core_phpunit\testcase {
 
     public function test_affecting_factors() {
         $this->resetAfterTest(true);
diff --git a/factor/token/tests/factor_test.php b/factor/token/tests/factor_test.php
index c14e8d4e..8be19fa1 100644
--- a/factor/token/tests/factor_test.php
+++ b/factor/token/tests/factor_test.php
@@ -14,8 +14,6 @@
 // You should have received a copy of the GNU General Public License
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
-namespace factor_token\tests;
-
 /**
  * Tests for MFA manager class.
  *
@@ -25,7 +23,7 @@
  * @copyright   Catalyst IT
  * @license     http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
-class factor_test extends \advanced_testcase {
+class token_factor_test extends \core_phpunit\testcase {
 
     public function setUp(): void {
         $this->resetAfterTest();
diff --git a/factor/totp/tests/factor_test.php b/factor/totp/tests/factor_test.php
index 2856f5dc..e663f8e4 100644
--- a/factor/totp/tests/factor_test.php
+++ b/factor/totp/tests/factor_test.php
@@ -14,8 +14,6 @@
 // You should have received a copy of the GNU General Public License
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
-namespace factor_totp\tests;
-
 defined('MOODLE_INTERNAL') || die();
 
 require_once(__DIR__.'/../extlib/OTPHP/OTPInterface.php');
@@ -37,7 +35,7 @@
  * @copyright   Catalyst IT
  * @license     http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
-class factor_test extends \advanced_testcase {
+class totp_factor_test extends \core_phpunit\testcase {
 
     /**
      * Test code validation of the TOTP factor
diff --git a/tests/admin_setting_managemfa_test.php b/tests/admin_setting_managemfa_test.php
index f5fb6c2e..e787b5ce 100644
--- a/tests/admin_setting_managemfa_test.php
+++ b/tests/admin_setting_managemfa_test.php
@@ -14,8 +14,6 @@
 // You should have received a copy of the GNU General Public License
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
-namespace tool_mfa\tests;
-
 defined('MOODLE_INTERNAL') || die();
 
 require_once(__DIR__ . '/tool_mfa_testcase.php');
diff --git a/tests/manager_test.php b/tests/manager_test.php
index 1996007c..7cf8404a 100644
--- a/tests/manager_test.php
+++ b/tests/manager_test.php
@@ -14,8 +14,6 @@
 // You should have received a copy of the GNU General Public License
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
-namespace tool_mfa\tests;
-
 defined('MOODLE_INTERNAL') || die();
 require_once(__DIR__ . '/tool_mfa_testcase.php');
 
diff --git a/tests/object_factor_base_test.php b/tests/object_factor_base_test.php
index 895b2579..6f4500e8 100644
--- a/tests/object_factor_base_test.php
+++ b/tests/object_factor_base_test.php
@@ -13,7 +13,6 @@
 //
 // You should have received a copy of the GNU General Public License
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
-namespace tool_mfa\tests;
 
 defined('MOODLE_INTERNAL') || die();
 
diff --git a/tests/plugininfo_factor_test.php b/tests/plugininfo_factor_test.php
index 4e5aa27e..e94cf966 100644
--- a/tests/plugininfo_factor_test.php
+++ b/tests/plugininfo_factor_test.php
@@ -22,7 +22,7 @@
  * @copyright   Catalyst IT
  * @license     http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
-class plugininfo_factor_test extends advanced_testcase {
+class plugininfo_factor_test extends \core_phpunit\testcase {
 
     public function test_get_next_user_factor() {
 
diff --git a/tests/secret_manager_test.php b/tests/secret_manager_test.php
index 6ef09c92..aa447e4b 100644
--- a/tests/secret_manager_test.php
+++ b/tests/secret_manager_test.php
@@ -14,8 +14,6 @@
 // You should have received a copy of the GNU General Public License
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
-namespace tool_mfa\tests;
-
 /**
  * Tests for MFA secret manager class.
  *
@@ -24,7 +22,7 @@
  * @copyright   Catalyst IT
  * @license     http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
-class secret_manager_test extends \advanced_testcase {
+class secret_manager_test extends \core_phpunit\testcase {
 
     public function test_create_secret() {
         global $DB;
diff --git a/tests/tool_mfa_testcase.php b/tests/tool_mfa_testcase.php
index 5d15a5a9..1fb48834 100644
--- a/tests/tool_mfa_testcase.php
+++ b/tests/tool_mfa_testcase.php
@@ -14,8 +14,6 @@
 // You should have received a copy of the GNU General Public License
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
-namespace tool_mfa\tests;
-
 defined('MOODLE_INTERNAL') || die();
 
 global $CFG;
@@ -31,7 +29,7 @@
  * @copyright   Catalyst IT
  * @license     http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
-abstract class tool_mfa_testcase extends \advanced_testcase {
+abstract class tool_mfa_testcase extends \core_phpunit\testcase {
 
     /**
      * Sets the state of the factor, in particular the weight and whether it is enabled