diff --git tests/phpunit/includes/bootstrap.php tests/phpunit/includes/bootstrap.php
index 5d3e159685..7059a560e7 100644
--- tests/phpunit/includes/bootstrap.php
+++ tests/phpunit/includes/bootstrap.php
@@ -115,6 +115,16 @@ require dirname( __FILE__ ) . '/testcase-canonical.php';
 require dirname( __FILE__ ) . '/exceptions.php';
 require dirname( __FILE__ ) . '/utils.php';
 require dirname( __FILE__ ) . '/spy-rest-server.php';
+require dirname( __FILE__ ) . '/class-mock-passwordhash.php';
+
+/**
+ * Override the $wp_hasher global that contains an instance of the PasswordHash class.
+ *
+ * By mocking the hashing functions used for password handling, we can speed up user creation in unit tests.
+ *
+ * @since 5.0.0
+ */
+$GLOBALS['wp_hasher'] = new Mock_PasswordHash();
 
 /**
  * A child class of the PHP test runner.
diff --git tests/phpunit/includes/class-mock-passwordhash.php tests/phpunit/includes/class-mock-passwordhash.php
new file mode 100644
index 0000000000..abbb2a7c6b
--- /dev/null
+++ tests/phpunit/includes/class-mock-passwordhash.php
@@ -0,0 +1,20 @@
+<?php
+/**
+ * Mock of the phpass class.
+ *
+ * @since 5.0.0
+ */
+
+/**
+ * Class Mock_PasswordHash
+ */
+class Mock_PasswordHash {
+	function HashPassword( $password ) {
+		// The password needs to be longer than 32 characters, so that `wp_check_password()` uses the hasher class.
+		return 'bar_bar_bar_bar_bar_bar_bar_bar_bar_';
+	}
+
+	function CheckPassword( $password, $stored_hash ) {
+		return true;
+	}
+}
diff --git tests/phpunit/tests/auth.php tests/phpunit/tests/auth.php
index 5a1084fc57..825c080e02 100644
--- tests/phpunit/tests/auth.php
+++ tests/phpunit/tests/auth.php
@@ -16,6 +16,12 @@ class Tests_Auth extends WP_UnitTestCase {
 	protected $nonce_failure_hook = 'wp_verify_nonce_failed';
 
 	public static function wpSetUpBeforeClass( $factory ) {
+		/**
+		 * Set the $wp_hasher global to null. This causes the password related functions in Core to create a valid
+		 * instance of the PasswordHash class.
+		 */
+		$GLOBALS['wp_hasher'] = null;
+
 		self::$_user = $factory->user->create_and_get(
 			array(
 				'user_login' => 'password-tests',
@@ -28,6 +34,11 @@ class Tests_Auth extends WP_UnitTestCase {
 		self::$wp_hasher = new PasswordHash( 8, true );
 	}
 
+	public static function wpTearDownAfterClass() {
+		// Set the $wp_hasher global to the test mock.
+		$GLOBALS['wp_hasher'] = new Mock_PasswordHash();
+	}
+
 	function setUp() {
 		parent::setUp();
 
diff --git tests/phpunit/tests/xmlrpc/basic.php tests/phpunit/tests/xmlrpc/basic.php
index 68c8e8f0df..d02e4b5fcd 100644
--- tests/phpunit/tests/xmlrpc/basic.php
+++ tests/phpunit/tests/xmlrpc/basic.php
@@ -37,6 +37,12 @@ class Tests_XMLRPC_Basic extends WP_XMLRPC_UnitTestCase {
 	 * @ticket 34336
 	 */
 	function test_multicall_invalidates_all_calls_after_invalid_call() {
+		/**
+		 * Set the $wp_hasher global to null. This causes the password related functions in Core to create a valid
+		 * instance of the PasswordHash class.
+		 */
+		$GLOBALS['wp_hasher'] = null;
+
 		$editor_id = $this->make_user_by_role( 'editor' );
 		$post_id   = self::factory()->post->create(
 			array(
@@ -94,6 +100,8 @@ class Tests_XMLRPC_Basic extends WP_XMLRPC_UnitTestCase {
 		$this->assertArrayHasKey( 'faultCode', $result[1] );
 		$this->assertArrayHasKey( 'faultCode', $result[2] );
 
+		// Set the $wp_hasher global to the test mock.
+		$GLOBALS['wp_hasher'] = new Mock_PasswordHash();
 	}
 
 	/**
diff --git tests/phpunit/tests/xmlrpc/wp/editProfile.php tests/phpunit/tests/xmlrpc/wp/editProfile.php
index e637016ef9..6d862ca761 100644
--- tests/phpunit/tests/xmlrpc/wp/editProfile.php
+++ tests/phpunit/tests/xmlrpc/wp/editProfile.php
@@ -40,6 +40,12 @@ class Tests_XMLRPC_wp_editProfile extends WP_XMLRPC_UnitTestCase {
 	}
 
 	function test_ignore_password_change() {
+		/**
+		 * Set the $wp_hasher global to null. This causes the password related functions in Core to create a valid
+		 * instance of the PasswordHash class.
+		 */
+		$GLOBALS['wp_hasher'] = null;
+
 		$this->make_user_by_role( 'author' );
 		$new_pass = 'newpassword';
 		$new_data = array( 'password' => $new_pass );
@@ -52,6 +58,9 @@ class Tests_XMLRPC_wp_editProfile extends WP_XMLRPC_UnitTestCase {
 		$auth_new = wp_authenticate( 'author', $new_pass );
 		$this->assertInstanceOf( 'WP_User', $auth_old );
 		$this->assertWPError( $auth_new );
+
+		// Set the $wp_hasher global to the test mock.
+		$GLOBALS['wp_hasher'] = new Mock_PasswordHash();
 	}
 
 	function test_ignore_email_change() {
