diff --git a/core/modules/user/src/Tests/UserRoleDeleteTest.php b/core/modules/user/src/Tests/UserRoleDeleteTest.php
index 81396ac..b1d13c3 100644
--- a/core/modules/user/src/Tests/UserRoleDeleteTest.php
+++ b/core/modules/user/src/Tests/UserRoleDeleteTest.php
@@ -7,7 +7,9 @@
 
 namespace Drupal\user\Tests;
 
+use Drupal\Component\Utility\Unicode;
 use Drupal\simpletest\KernelTestBase;
+use Drupal\user\Entity\Role;
 use Drupal\user\Entity\User;
 
 /**
@@ -76,4 +78,28 @@ public function testRoleDeleteUserRoleReferenceDelete() {
 
   }
 
+  /**
+   * Tests user_roles() static cache invalidation on role deletion.
+   *
+   * @see user_roles()
+   */
+  public function testStaticCacheInvalidation() {
+    $role = Role::create([
+      'id' => Unicode::strtolower($this->randomMachineName())
+    ]);
+    $role->save();
+
+    // Load all roles using user_role().
+    $roles = user_roles();
+    // The user role $role is in the 'all roles' list.
+    $this->assertTrue(isset($roles[$role->id()]));
+
+    // Delete the role.
+    $role->delete();
+    // Reload all roles.
+    $roles = user_roles();
+    // The user role $role should not be in the list anymore.
+    $this->assertFalse(isset($roles[$role->id()]));
+  }
+
 }
