From 26ae3f89d5865b16278473b7a2cac5fde2ff1c8d Mon Sep 17 00:00:00 2001
From: "lee.5151" <lee.5151@osu.edu>
Date: Mon, 17 Jul 2023 13:45:07 -0400
Subject: [PATCH] Upgrading drupal/userprotect (1.1.0 => 1.2.0)

---
 composer.json                                 |  2 +-
 composer.lock                                 | 18 ++++----
 vendor/composer/installed.json                | 26 +++++------
 vendor/composer/installed.php                 | 10 ++---
 .../userprotect/{README.txt => README.md}     | 43 +++++++------------
 .../src/Access/UserProtectRoleAccessCheck.php |  2 +-
 .../src/Routing/RouteSubscriber.php           |  4 +-
 .../userprotect_test.info.yml                 | 10 ++---
 .../tests/src/Functional/InstallTest.php      |  6 +--
 .../src/Functional/ProtectionRuleCrudTest.php | 26 +++++++----
 .../RoleDelegationIntegrationTest.php         |  4 +-
 .../Functional/UnsavedUserFieldAccessTest.php | 18 +++++---
 .../Functional/UserProtectBrowserTestBase.php |  2 +-
 .../UserProtectionPermissionsTest.php         | 26 +++++++----
 .../src/Functional/UserProtectionTest.php     |  8 +++-
 .../Kernel/Entity/ProtectionRuleUnitTest.php  | 30 ++++++-------
 .../tests/src/Kernel/FieldAccessTest.php      |  2 +-
 .../src/Kernel/ProtectionRuleBypassTest.php   | 14 ++++--
 .../src/Kernel/UserProtectKernelTestBase.php  |  4 +-
 .../UserProtectionBaseUnitTest.php            |  6 +--
 web/modules/userprotect/userprotect.info.yml  |  8 ++--
 web/modules/userprotect/userprotect.module    |  6 +++
 22 files changed, 152 insertions(+), 123 deletions(-)
 rename web/modules/userprotect/{README.txt => README.md} (72%)

diff --git a/composer.json b/composer.json
index 1e882992f8..d36dc7fb2a 100644
--- a/composer.json
+++ b/composer.json
@@ -164,7 +164,7 @@
         "drupal/twig_tweak": "^3.2",
         "drupal/twitter_block": "3.0-alpha1",
         "drupal/ultimate_cron": "^2.0@alpha",
-        "drupal/userprotect": "1.1",
+        "drupal/userprotect": "1.2",
         "drupal/video_embed_field": "2.5",
         "drupal/view_unpublished": "1.0",
         "drupal/views_ajax_history": "1.7",
diff --git a/composer.lock b/composer.lock
index 9db35f1665..d11795dc16 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,7 +4,7 @@
         "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
         "This file is @generated automatically"
     ],
-    "content-hash": "eb946465456843157a6b08ca3538cf84",
+    "content-hash": "e6892b904264997697258f5f16aab082",
     "packages": [
         {
             "name": "alchemy/zippy",
@@ -7381,20 +7381,20 @@
         },
         {
             "name": "drupal/userprotect",
-            "version": "1.1.0",
+            "version": "1.2.0",
             "source": {
                 "type": "git",
                 "url": "https://git.drupalcode.org/project/userprotect.git",
-                "reference": "8.x-1.1"
+                "reference": "8.x-1.2"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://ftp.drupal.org/files/projects/userprotect-8.x-1.1.zip",
-                "reference": "8.x-1.1",
-                "shasum": "485e240317a7fc1c0523b082f333c983ea3ca639"
+                "url": "https://ftp.drupal.org/files/projects/userprotect-8.x-1.2.zip",
+                "reference": "8.x-1.2",
+                "shasum": "f3246af48c60b85bb8f240cd98c286e5b38eb33c"
             },
             "require": {
-                "drupal/core": "^8 || ^9"
+                "drupal/core": "^8 || ^9 || ^10"
             },
             "require-dev": {
                 "drupal/role_delegation": "^1.0"
@@ -7402,8 +7402,8 @@
             "type": "drupal-module",
             "extra": {
                 "drupal": {
-                    "version": "8.x-1.1",
-                    "datestamp": "1578341583",
+                    "version": "8.x-1.2",
+                    "datestamp": "1670669515",
                     "security-coverage": {
                         "status": "covered",
                         "message": "Covered by Drupal's security advisory policy"
diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json
index 002646feec..01c27f34c0 100644
--- a/vendor/composer/installed.json
+++ b/vendor/composer/installed.json
@@ -7644,21 +7644,21 @@
         },
         {
             "name": "drupal/userprotect",
-            "version": "1.1.0",
-            "version_normalized": "1.1.0.0",
+            "version": "1.2.0",
+            "version_normalized": "1.2.0.0",
             "source": {
                 "type": "git",
                 "url": "https://git.drupalcode.org/project/userprotect.git",
-                "reference": "8.x-1.1"
+                "reference": "8.x-1.2"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://ftp.drupal.org/files/projects/userprotect-8.x-1.1.zip",
-                "reference": "8.x-1.1",
-                "shasum": "485e240317a7fc1c0523b082f333c983ea3ca639"
+                "url": "https://ftp.drupal.org/files/projects/userprotect-8.x-1.2.zip",
+                "reference": "8.x-1.2",
+                "shasum": "f3246af48c60b85bb8f240cd98c286e5b38eb33c"
             },
             "require": {
-                "drupal/core": "^8 || ^9"
+                "drupal/core": "^8 || ^9 || ^10"
             },
             "require-dev": {
                 "drupal/role_delegation": "^1.0"
@@ -7666,8 +7666,8 @@
             "type": "drupal-module",
             "extra": {
                 "drupal": {
-                    "version": "8.x-1.1",
-                    "datestamp": "1578341583",
+                    "version": "8.x-1.2",
+                    "datestamp": "1670669515",
                     "security-coverage": {
                         "status": "covered",
                         "message": "Covered by Drupal's security advisory policy"
@@ -7680,13 +7680,13 @@
                 "GPL-2.0+"
             ],
             "authors": [
-                {
-                    "name": "MegaChriz",
-                    "homepage": "https://www.drupal.org/user/654114"
-                },
                 {
                     "name": "karschsp",
                     "homepage": "https://www.drupal.org/user/138216"
+                },
+                {
+                    "name": "MegaChriz",
+                    "homepage": "https://www.drupal.org/user/654114"
                 }
             ],
             "description": "Allows admins to protect users from being edited or cancelled, on a per-user basis.",
diff --git a/vendor/composer/installed.php b/vendor/composer/installed.php
index 19d1f4e1c3..91bb67b698 100644
--- a/vendor/composer/installed.php
+++ b/vendor/composer/installed.php
@@ -3,7 +3,7 @@
         'name' => 'osu-asc-webservices/d8-upstream',
         'pretty_version' => 'dev-master',
         'version' => 'dev-master',
-        'reference' => '52c5f239f26a10cfa3c2d3933c105ad12c2230cf',
+        'reference' => 'da223c6c20ccc82a51dd34259bfae19cded9ab73',
         'type' => 'project',
         'install_path' => __DIR__ . '/../../',
         'aliases' => array(),
@@ -1220,9 +1220,9 @@
             'dev_requirement' => false,
         ),
         'drupal/userprotect' => array(
-            'pretty_version' => '1.1.0',
-            'version' => '1.1.0.0',
-            'reference' => '8.x-1.1',
+            'pretty_version' => '1.2.0',
+            'version' => '1.2.0.0',
+            'reference' => '8.x-1.2',
             'type' => 'drupal-module',
             'install_path' => __DIR__ . '/../../web/modules/userprotect',
             'aliases' => array(),
@@ -1549,7 +1549,7 @@
         'osu-asc-webservices/d8-upstream' => array(
             'pretty_version' => 'dev-master',
             'version' => 'dev-master',
-            'reference' => '52c5f239f26a10cfa3c2d3933c105ad12c2230cf',
+            'reference' => 'da223c6c20ccc82a51dd34259bfae19cded9ab73',
             'type' => 'project',
             'install_path' => __DIR__ . '/../../',
             'aliases' => array(),
diff --git a/web/modules/userprotect/README.txt b/web/modules/userprotect/README.md
similarity index 72%
rename from web/modules/userprotect/README.txt
rename to web/modules/userprotect/README.md
index 08624242eb..a23eb49bbc 100644
--- a/web/modules/userprotect/README.txt
+++ b/web/modules/userprotect/README.md
@@ -1,8 +1,7 @@
 User Protect
 ============
 
-CONTENTS OF THIS FILE
----------------------
+## CONTENTS OF THIS FILE
 
  * Introduction
  * Requirements
@@ -10,9 +9,7 @@ CONTENTS OF THIS FILE
  * Configuration
  * Maintainers
 
-
-INTRODUCTION
-------------
+## INTRODUCTION
 
 The User Protect module allows fine-grained access control of user
 administrators, by providing various editing protection for users. The
@@ -28,29 +25,23 @@ The following protections are supported:
  * Edit operation (user/X/edit)
  * Delete operation (user/X/cancel)
 
- * For a full description of the module visit:
-   https://www.drupal.org/project/userprotect
-
- * To submit bug reports and feature suggestions, or to track changes visit:
-   https://www.drupal.org/project/issues/userprotect
+For a full description of the module visit:
+<https://www.drupal.org/project/userprotect>
 
+To submit bug reports and feature suggestions, or to track changes visit:
+<https://www.drupal.org/project/issues/userprotect>
 
-REQUIREMENTS
-------------
+## REQUIREMENTS
 
 This module requires no modules outside of Drupal core.
 
+## INSTALLATION
 
-INSTALLATION
-------------
-
- * Install the User Protect module as you would normally install a contributed
-   Drupal module. Visit https://www.drupal.org/node/1897420 for further
-   information.
+Install the User Protect module as you would normally install a contributed
+Drupal module. Visit <https://www.drupal.org/node/1897420> for further
+information.
 
-
-CONFIGURATION
--------------
+## CONFIGURATION
 
     1. Navigate to Administration > Extend and enable the module.
     2. Navigate to Administration > Configuration > People > User protect for
@@ -58,11 +49,11 @@ CONFIGURATION
 
 There are two types of protection rules:
 
- * User based protection rules:
+ * User based protection rules:\
    This user will be protected for all users except: "User 1" (admin), the
    protected user itself, and users with the permissions to "Bypass all user
    protections".
- * Role based protection rules:
+ * Role based protection rules:\
    This role will be protected for all users except: "User 1" (admin), and users
    with the permissions to "Bypass all user protections".
 
@@ -81,8 +72,6 @@ Protected fields will be disabled or hidden on the form at user/X/edit. The edit
 and delete operations are protected by controlling entity access for the
 operations 'update' and 'delete'.
 
+## MAINTAINERS
 
-MAINTAINERS
------------
-
- * Youri van Koppen (MegaChriz) - https://www.drupal.org/user/654114
+ * Youri van Koppen (MegaChriz) - <https://www.drupal.org/user/654114>
diff --git a/web/modules/userprotect/src/Access/UserProtectRoleAccessCheck.php b/web/modules/userprotect/src/Access/UserProtectRoleAccessCheck.php
index a127d27cdc..f748077356 100644
--- a/web/modules/userprotect/src/Access/UserProtectRoleAccessCheck.php
+++ b/web/modules/userprotect/src/Access/UserProtectRoleAccessCheck.php
@@ -8,7 +8,7 @@
 use Drupal\user\UserInterface;
 
 /**
- * Class UserProtectRoleAccessCheck.
+ * Defines an access control handler for user roles.
  *
  * @package Drupal\userprotect\Access
  */
diff --git a/web/modules/userprotect/src/Routing/RouteSubscriber.php b/web/modules/userprotect/src/Routing/RouteSubscriber.php
index 0d68e36c06..738182cb1f 100644
--- a/web/modules/userprotect/src/Routing/RouteSubscriber.php
+++ b/web/modules/userprotect/src/Routing/RouteSubscriber.php
@@ -6,7 +6,9 @@
 use Symfony\Component\Routing\RouteCollection;
 
 /**
- * Class RouteSubscriber.
+ * Subscriber for user related routes.
+ *
+ * Adds an access requirement for a role_delegation route.
  *
  * @package Drupal\userprotect\Routing
  */
diff --git a/web/modules/userprotect/tests/modules/userprotect_test/userprotect_test.info.yml b/web/modules/userprotect/tests/modules/userprotect_test/userprotect_test.info.yml
index b5b1ca38b4..9278665a46 100644
--- a/web/modules/userprotect/tests/modules/userprotect_test/userprotect_test.info.yml
+++ b/web/modules/userprotect/tests/modules/userprotect_test/userprotect_test.info.yml
@@ -2,12 +2,10 @@ name: User protect test
 type: module
 description: 'Support module for the User protect tests.'
 package: Testing
-core: 8.x
-core_version_requirement: ^8 || ^9
 dependencies:
-  - userprotect
+  - userprotect:userprotect
 
-# Information added by Drupal.org packaging script on 2020-01-06
-version: '8.x-1.1'
+# Information added by Drupal.org packaging script on 2022-12-10
+version: '8.x-1.2'
 project: 'userprotect'
-datestamp: 1578341587
+datestamp: 1670669517
diff --git a/web/modules/userprotect/tests/src/Functional/InstallTest.php b/web/modules/userprotect/tests/src/Functional/InstallTest.php
index c2e19d1ee5..16c5cf96b3 100644
--- a/web/modules/userprotect/tests/src/Functional/InstallTest.php
+++ b/web/modules/userprotect/tests/src/Functional/InstallTest.php
@@ -14,7 +14,7 @@ class InstallTest extends BrowserTestBase {
   /**
    * {@inheritdoc}
    */
-  public static $modules = [];
+  protected static $modules = [];
 
   /**
    * Module handler to ensure installed modules.
@@ -38,7 +38,7 @@ class InstallTest extends BrowserTestBase {
   /**
    * {@inheritdoc}
    */
-  public function setUp() {
+  public function setUp(): void {
     parent::setUp();
     $this->moduleHandler = $this->container->get('module_handler');
     $this->moduleInstaller = $this->container->get('module_installer');
@@ -62,7 +62,7 @@ public function testInstallationAndUninstallation() {
     // Ensure an authenticated user can edit its own account.
     $this->drupalLogin($account);
     $this->drupalGet('user/' . $account->id() . '/edit');
-    $this->assertResponse(200, 'Authenticated user has access to edit page of own account.');
+    $this->assertSession()->statusCodeEquals(200);
 
     // Uninstall userprotect.
     $this->moduleInstaller->uninstall(['userprotect']);
diff --git a/web/modules/userprotect/tests/src/Functional/ProtectionRuleCrudTest.php b/web/modules/userprotect/tests/src/Functional/ProtectionRuleCrudTest.php
index 40a2309e00..b45e137545 100644
--- a/web/modules/userprotect/tests/src/Functional/ProtectionRuleCrudTest.php
+++ b/web/modules/userprotect/tests/src/Functional/ProtectionRuleCrudTest.php
@@ -22,7 +22,7 @@ class ProtectionRuleCrudTest extends UserProtectBrowserTestBase {
   /**
    * {@inheritdoc}
    */
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
 
     $this->account = $this->drupalCreateUser(['userprotect.administer']);
@@ -44,7 +44,8 @@ public function testCrudRoleProtectionRule() {
       'entity_id' => $rid,
       'protection[user_mail]' => TRUE,
     ];
-    $this->drupalPostForm('admin/config/people/userprotect/add', $edit, t('Save'));
+    $this->drupalGet('admin/config/people/userprotect/add');
+    $this->submitForm($edit, 'Save');
 
     // Assert that the rule was created.
     $protection_rule = ProtectionRule::load($rule_id);
@@ -65,7 +66,8 @@ public function testCrudRoleProtectionRule() {
       'protection[user_name]' => TRUE,
       'protection[user_mail]' => FALSE,
     ];
-    $this->drupalPostForm('admin/config/people/userprotect/manage/' . $rule_id, $edit, t('Save'));
+    $this->drupalGet('admin/config/people/userprotect/manage/' . $rule_id);
+    $this->submitForm($edit, 'Save');
 
     // Assert that the rule was updated with the expected values.
     $protection_rule = ProtectionRule::load($rule_id);
@@ -85,15 +87,17 @@ public function testCrudRoleProtectionRule() {
       'entity_id' => $rid,
       'protection[user_mail]' => TRUE,
     ];
-    $this->drupalPostForm('admin/config/people/userprotect/add', $edit, t('Save'));
+    $this->drupalGet('admin/config/people/userprotect/add');
+    $this->submitForm($edit, 'Save');
     $this->assertSession()->pageTextContains('The machine-readable name is already in use. It must be unique.');
 
     // Assert only one protection rule exists.
     $entities = ProtectionRule::loadMultiple(NULL);
     $this->assertCount(1, $entities, 'Only one protection rule exists.');
+    $this->drupalGet('admin/config/people/userprotect/manage/' . $rule_id . '/delete');
 
     // Delete rule.
-    $this->drupalPostForm('admin/config/people/userprotect/manage/' . $rule_id . '/delete', [], t('Delete'));
+    $this->submitForm([], 'Delete');
     // Assert the rule no longer exists.
     $protection_rule = ProtectionRule::load($rule_id);
     $this->assertEmpty($protection_rule, 'The protection rule was deleted.');
@@ -114,7 +118,8 @@ public function testCrudUserProtectionRule() {
       'entity_id' => $account->getAccountName(),
       'protection[user_mail]' => TRUE,
     ];
-    $this->drupalPostForm('admin/config/people/userprotect/add/user', $edit, t('Save'));
+    $this->drupalGet('admin/config/people/userprotect/add/user');
+    $this->submitForm($edit, 'Save');
 
     // Assert that the rule was created.
     $protection_rule = ProtectionRule::load($rule_id);
@@ -135,7 +140,8 @@ public function testCrudUserProtectionRule() {
       'protection[user_name]' => TRUE,
       'protection[user_mail]' => FALSE,
     ];
-    $this->drupalPostForm('admin/config/people/userprotect/manage/' . $rule_id, $edit, t('Save'));
+    $this->drupalGet('admin/config/people/userprotect/manage/' . $rule_id);
+    $this->submitForm($edit, 'Save');
 
     // Assert that the rule was updated with the expected values.
     $protection_rule = ProtectionRule::load($rule_id);
@@ -155,7 +161,8 @@ public function testCrudUserProtectionRule() {
       'entity_id' => $account->getAccountName(),
       'protection[user_mail]' => TRUE,
     ];
-    $this->drupalPostForm('admin/config/people/userprotect/add/user', $edit, t('Save'));
+    $this->drupalGet('admin/config/people/userprotect/add/user');
+    $this->submitForm($edit, 'Save');
     $this->assertSession()->pageTextContains('The machine-readable name is already in use. It must be unique.');
 
     // Assert only one protection rule exists.
@@ -163,7 +170,8 @@ public function testCrudUserProtectionRule() {
     $this->assertCount(1, $entities, 'Only one protection rule exists.');
 
     // Delete rule.
-    $this->drupalPostForm('admin/config/people/userprotect/manage/' . $rule_id . '/delete', [], t('Delete'));
+    $this->drupalGet('admin/config/people/userprotect/manage/' . $rule_id . '/delete');
+    $this->submitForm([], 'Delete');
     // Assert the rule no longer exists.
     $protection_rule = ProtectionRule::load($rule_id);
     $this->assertEmpty($protection_rule, 'The protection rule was deleted.');
diff --git a/web/modules/userprotect/tests/src/Functional/RoleDelegation/RoleDelegationIntegrationTest.php b/web/modules/userprotect/tests/src/Functional/RoleDelegation/RoleDelegationIntegrationTest.php
index 71f7f5cb03..3110ba24b5 100644
--- a/web/modules/userprotect/tests/src/Functional/RoleDelegation/RoleDelegationIntegrationTest.php
+++ b/web/modules/userprotect/tests/src/Functional/RoleDelegation/RoleDelegationIntegrationTest.php
@@ -17,7 +17,7 @@ class RoleDelegationIntegrationTest extends BrowserTestBase {
    *
    * @var array
    */
-  public static $modules = ['userprotect', 'user', 'role_delegation'];
+  protected static $modules = ['userprotect', 'user', 'role_delegation'];
 
   /**
    * {@inheritdoc}
@@ -62,7 +62,7 @@ class RoleDelegationIntegrationTest extends BrowserTestBase {
   /**
    * {@inheritdoc}
    */
-  public function setUp() {
+  public function setUp(): void {
     parent::setUp();
 
     $admin_role = $this->createAdminRole();
diff --git a/web/modules/userprotect/tests/src/Functional/UnsavedUserFieldAccessTest.php b/web/modules/userprotect/tests/src/Functional/UnsavedUserFieldAccessTest.php
index bd35f4f15a..b210e839b6 100644
--- a/web/modules/userprotect/tests/src/Functional/UnsavedUserFieldAccessTest.php
+++ b/web/modules/userprotect/tests/src/Functional/UnsavedUserFieldAccessTest.php
@@ -24,10 +24,14 @@ class UnsavedUserFieldAccessTest extends UserProtectBrowserTestBase {
   /**
    * {@inheritdoc}
    */
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
 
-    $this->account = $this->drupalCreateUser(['administer users', 'administer permissions']);
+    $this->account = $this->drupalCreateUser(
+      [
+        'administer users',
+        'administer permissions',
+      ]);
     $this->drupalLogin($this->account);
   }
 
@@ -44,8 +48,9 @@ public function testUserCreate() {
       'pass[pass2]' => $pass,
       'notify' => FALSE,
     ];
-    $this->drupalPostForm('admin/people/create', $edit, t('Create new account'));
-    $this->assertSession()->pageTextContains(t('Created a new user account for @name. No email has been sent.', ['@name' => $edit['name']]), 'User created');
+    $this->drupalGet('admin/people/create');
+    $this->submitForm($edit, 'Create new account');
+    $this->assertSession()->pageTextContains(strtr('Created a new user account for @name. No email has been sent.', ['@name' => $edit['name']]));
 
     // Try to create an user with the same name and assert that it doesn't
     // result into a fatal error.
@@ -56,8 +61,9 @@ public function testUserCreate() {
       'pass[pass2]' => $pass,
       'notify' => FALSE,
     ];
-    $this->drupalPostForm('admin/people/create', $edit, t('Create new account'));
-    $this->assertSession()->pageTextContains(t('The username @name is already taken.', ['@name' => $edit['name']]));
+    $this->drupalGet('admin/people/create');
+    $this->submitForm($edit, 'Create new account');
+    $this->assertSession()->pageTextContains(strtr('The username @name is already taken.', ['@name' => $edit['name']]));
   }
 
   /**
diff --git a/web/modules/userprotect/tests/src/Functional/UserProtectBrowserTestBase.php b/web/modules/userprotect/tests/src/Functional/UserProtectBrowserTestBase.php
index a0f6d8ed7c..4d8849e86b 100644
--- a/web/modules/userprotect/tests/src/Functional/UserProtectBrowserTestBase.php
+++ b/web/modules/userprotect/tests/src/Functional/UserProtectBrowserTestBase.php
@@ -16,7 +16,7 @@ abstract class UserProtectBrowserTestBase extends BrowserTestBase {
   /**
    * {@inheritdoc}
    */
-  public static $modules = ['userprotect', 'userprotect_test'];
+  protected static $modules = ['userprotect', 'userprotect_test'];
 
   /**
    * {@inheritdoc}
diff --git a/web/modules/userprotect/tests/src/Functional/UserProtectionPermissionsTest.php b/web/modules/userprotect/tests/src/Functional/UserProtectionPermissionsTest.php
index 5b618eb191..56a3e05af3 100644
--- a/web/modules/userprotect/tests/src/Functional/UserProtectionPermissionsTest.php
+++ b/web/modules/userprotect/tests/src/Functional/UserProtectionPermissionsTest.php
@@ -26,7 +26,7 @@ class UserProtectionPermissionsTest extends UserProtectBrowserTestBase {
   /**
    * {@inheritdoc}
    */
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
 
     // Revoke default permissions on the authenticated user role that are
@@ -47,13 +47,18 @@ protected function setUp() {
    */
   public function testEditOwnMail() {
     // Create account that may edit its own mail address.
-    $account = $this->drupalCreateUser(['userprotect.mail.edit', 'userprotect.account.edit']);
+    $account = $this->drupalCreateUser(
+      [
+        'userprotect.mail.edit',
+        'userprotect.account.edit',
+      ]);
     $this->drupalLogin($account);
 
     $edit = [
       'mail' => $this->randomMachineName() . '@example.com',
     ];
-    $this->drupalPostForm('user/' . $account->id() . '/edit', $edit, t('Save'));
+    $this->drupalGet('user/' . $account->id() . '/edit');
+    $this->submitForm($edit, 'Save');
 
     // Assert the mail address changed.
     $account = $this->reloadEntity($account);
@@ -69,7 +74,6 @@ public function testEditOwnMail() {
   public function testNoEditOwnMail() {
     // Create account that may NOT edit its own mail address.
     $account = $this->drupalCreateUser(['userprotect.account.edit']);
-    $expected_mail = $account->getEmail();
     $this->drupalLogin($account);
 
     $this->drupalGet('user/' . $account->id() . '/edit');
@@ -84,7 +88,11 @@ public function testNoEditOwnMail() {
    */
   public function testEditOwnPass() {
     // Create account that may edit its own password.
-    $account = $this->drupalCreateUser(['userprotect.pass.edit', 'userprotect.account.edit']);
+    $account = $this->drupalCreateUser(
+      [
+        'userprotect.pass.edit',
+        'userprotect.account.edit',
+      ]);
     $this->drupalLogin($account);
 
     $new_pass = $this->randomMachineName();
@@ -93,7 +101,8 @@ public function testEditOwnPass() {
       'pass[pass1]' => $new_pass,
       'pass[pass2]' => $new_pass,
     ];
-    $this->drupalPostForm('user/' . $account->id() . '/edit', $edit, t('Save'));
+    $this->drupalGet('user/' . $account->id() . '/edit');
+    $this->submitForm($edit, 'Save');
 
     // Assert the password changed.
     $account = $this->reloadEntity($account);
@@ -111,7 +120,6 @@ public function testEditOwnPass() {
   public function testNoEditOwnPass() {
     // Create account that may NOT edit its own password.
     $account = $this->drupalCreateUser(['userprotect.account.edit']);
-    $expected_pass = $account->pass_raw;
     $this->drupalLogin($account);
 
     $this->drupalGet('user/' . $account->id() . '/edit');
@@ -132,7 +140,7 @@ public function testEditOwnAccount() {
 
     // Assert the user can edit its own account.
     $this->drupalGet('user/' . $account->id() . '/edit');
-    $this->assertResponse(200, "The user may edit its own account.");
+    $this->assertSession()->statusCodeEquals(200);
   }
 
   /**
@@ -148,7 +156,7 @@ public function testNoEditOwnAccount() {
 
     // Assert the user can edit its own account.
     $this->drupalGet('user/' . $account->id() . '/edit');
-    $this->assertResponse(403, "The user may NOT edit its own account.");
+    $this->assertSession()->statusCodeEquals(403);
   }
 
 }
diff --git a/web/modules/userprotect/tests/src/Functional/UserProtectionTest.php b/web/modules/userprotect/tests/src/Functional/UserProtectionTest.php
index 72edbfeea2..286f4fa5aa 100644
--- a/web/modules/userprotect/tests/src/Functional/UserProtectionTest.php
+++ b/web/modules/userprotect/tests/src/Functional/UserProtectionTest.php
@@ -20,10 +20,14 @@ class UserProtectionTest extends UserProtectBrowserTestBase {
   /**
    * {@inheritdoc}
    */
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
 
-    $this->account = $this->drupalCreateUser(['administer users', 'administer permissions']);
+    $this->account = $this->drupalCreateUser(
+      [
+        'administer users',
+        'administer permissions',
+      ]);
     $this->drupalLogin($this->account);
   }
 
diff --git a/web/modules/userprotect/tests/src/Kernel/Entity/ProtectionRuleUnitTest.php b/web/modules/userprotect/tests/src/Kernel/Entity/ProtectionRuleUnitTest.php
index 8a9f599b65..f5e7160d6f 100644
--- a/web/modules/userprotect/tests/src/Kernel/Entity/ProtectionRuleUnitTest.php
+++ b/web/modules/userprotect/tests/src/Kernel/Entity/ProtectionRuleUnitTest.php
@@ -21,7 +21,7 @@ class ProtectionRuleUnitTest extends KernelTestBase {
   /**
    * {@inheritdoc}
    */
-  public static $modules = ['user', 'userprotect', 'field'];
+  protected static $modules = ['user', 'userprotect', 'field'];
 
   /**
    * The user protection plugin manager.
@@ -40,7 +40,7 @@ class ProtectionRuleUnitTest extends KernelTestBase {
   /**
    * {@inheritdoc}
    */
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
     $this->manager = UserProtect::pluginManager();
     $this->protectionRule = ProtectionRule::create([
@@ -60,37 +60,37 @@ protected function setUp() {
    * Tests id().
    */
   public function testId() {
-    $this->assertIdentical('dummy', $this->protectionRule->id());
+    $this->assertSame('dummy', $this->protectionRule->id());
   }
 
   /**
    * Tests setProtectedEntityTypeId() and getProtectedEntityTypeId().
    */
   public function testProtectedEntityTypeId() {
-    $this->assertIdentical('user_role', $this->protectionRule->getProtectedEntityTypeId());
+    $this->assertSame('user_role', $this->protectionRule->getProtectedEntityTypeId());
     $entity_type = 'user';
     $this->assertInstanceOf(ProtectionRuleInterface::class, $this->protectionRule->setProtectedEntityTypeId($entity_type));
-    $this->assertIdentical($entity_type, $this->protectionRule->getProtectedEntityTypeId());
+    $this->assertSame($entity_type, $this->protectionRule->getProtectedEntityTypeId());
   }
 
   /**
    * Tests setProtectedEntityId() and getProtectedEntityId().
    */
   public function testProtectedEntityId() {
-    $this->assertIdentical('administrator', $this->protectionRule->getProtectedEntityId());
+    $this->assertSame('administrator', $this->protectionRule->getProtectedEntityId());
     $entity_id = 'authenticated';
     $this->assertInstanceOf(ProtectionRuleInterface::class, $this->protectionRule->setProtectedEntityId($entity_id));
-    $this->assertIdentical($entity_id, $this->protectionRule->getProtectedEntityId());
+    $this->assertSame($entity_id, $this->protectionRule->getProtectedEntityId());
   }
 
   /**
    * Tests setBypassRoles() and getBypassRoles().
    */
   public function testBypassRoles() {
-    $this->assertIdentical([], $this->protectionRule->getBypassRoles());
+    $this->assertSame([], $this->protectionRule->getBypassRoles());
     $roles = ['administrator'];
     $this->assertInstanceOf(ProtectionRuleInterface::class, $this->protectionRule->setBypassRoles($roles));
-    $this->assertIdentical($roles, $this->protectionRule->getBypassRoles());
+    $this->assertSame($roles, $this->protectionRule->getBypassRoles());
   }
 
   /**
@@ -128,23 +128,23 @@ public function testDisableProtection() {
    */
   public function testToArray() {
     $array = $this->protectionRule->toArray();
-    $this->assertIdentical('dummy', $array['name']);
-    $this->assertIdentical('Dummy', $array['label']);
+    $this->assertSame('dummy', $array['name']);
+    $this->assertSame('Dummy', $array['label']);
     $expected_protections = [
       'user_mail' => [
         'status' => TRUE,
       ],
     ];
-    $this->assertIdentical($expected_protections, $array['protections']);
-    $this->assertIdentical('user_role', $array['protectedEntityTypeId']);
-    $this->assertIdentical('administrator', $array['protectedEntityId']);
+    $this->assertSame($expected_protections, $array['protections']);
+    $this->assertSame('user_role', $array['protectedEntityTypeId']);
+    $this->assertSame('administrator', $array['protectedEntityId']);
   }
 
   /**
    * Tests getPermissionName().
    */
   public function testGetPermissionName() {
-    $this->assertIdentical('userprotect.dummy.bypass', $this->protectionRule->getPermissionName());
+    $this->assertSame('userprotect.dummy.bypass', $this->protectionRule->getPermissionName());
   }
 
   /**
diff --git a/web/modules/userprotect/tests/src/Kernel/FieldAccessTest.php b/web/modules/userprotect/tests/src/Kernel/FieldAccessTest.php
index 1e132254a7..9e863d21d5 100644
--- a/web/modules/userprotect/tests/src/Kernel/FieldAccessTest.php
+++ b/web/modules/userprotect/tests/src/Kernel/FieldAccessTest.php
@@ -19,7 +19,7 @@ class FieldAccessTest extends UserProtectKernelTestBase {
   /**
    * {@inheritdoc}
    */
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
 
     // Create an user who administer users. Explicitly set user ID to '2'
diff --git a/web/modules/userprotect/tests/src/Kernel/ProtectionRuleBypassTest.php b/web/modules/userprotect/tests/src/Kernel/ProtectionRuleBypassTest.php
index 20eacbc6d7..3e8f7feaf0 100644
--- a/web/modules/userprotect/tests/src/Kernel/ProtectionRuleBypassTest.php
+++ b/web/modules/userprotect/tests/src/Kernel/ProtectionRuleBypassTest.php
@@ -20,7 +20,7 @@ class ProtectionRuleBypassTest extends UserProtectKernelTestBase {
   /**
    * {@inheritdoc}
    */
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
 
     $this->accessController = \Drupal::entityTypeManager()->getAccessControlHandler('user');
@@ -78,7 +78,11 @@ protected function doRoleProtectionBypassTest($plugin, $operation) {
     $protected_account->addRole($rid);
 
     // Create operating account.
-    $account = $this->drupalCreateUser(['administer users', 'userprotect.dummy.bypass']);
+    $account = $this->drupalCreateUser(
+      [
+        'administer users',
+        'userprotect.dummy.bypass',
+      ]);
 
     // Test if account has the expected access.
     $this->assertTrue($this->accessController->access($protected_account, $operation, $account));
@@ -132,7 +136,11 @@ protected function doUserProtectionBypassTest($plugin, $operation) {
     $protected_account = $this->createProtectedUser([$plugin]);
 
     // Create operating account.
-    $account = $this->drupalCreateUser(['administer users', 'userprotect.dummy.bypass']);
+    $account = $this->drupalCreateUser(
+      [
+        'administer users',
+        'userprotect.dummy.bypass',
+      ]);
 
     // Test if account has the expected access.
     $this->assertTrue($this->accessController->access($protected_account, $operation, $account));
diff --git a/web/modules/userprotect/tests/src/Kernel/UserProtectKernelTestBase.php b/web/modules/userprotect/tests/src/Kernel/UserProtectKernelTestBase.php
index b5b099fbf9..ca0a495f38 100644
--- a/web/modules/userprotect/tests/src/Kernel/UserProtectKernelTestBase.php
+++ b/web/modules/userprotect/tests/src/Kernel/UserProtectKernelTestBase.php
@@ -15,12 +15,12 @@ abstract class UserProtectKernelTestBase extends EntityKernelTestBase {
   /**
    * {@inheritdoc}
    */
-  public static $modules = ['userprotect'];
+  protected static $modules = ['userprotect'];
 
   /**
    * {@inheritdoc}
    */
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
     $this->installSchema('user', ['users_data']);
   }
diff --git a/web/modules/userprotect/tests/src/Unit/Plugin/UserProtection/UserProtectionBaseUnitTest.php b/web/modules/userprotect/tests/src/Unit/Plugin/UserProtection/UserProtectionBaseUnitTest.php
index 904fc1dac8..6f95d8efbd 100644
--- a/web/modules/userprotect/tests/src/Unit/Plugin/UserProtection/UserProtectionBaseUnitTest.php
+++ b/web/modules/userprotect/tests/src/Unit/Plugin/UserProtection/UserProtectionBaseUnitTest.php
@@ -40,7 +40,7 @@ class UserProtectionBaseUnitTest extends UnitTestCase {
   /**
    * {@inheritdoc}
    */
-  public function setUp() {
+  public function setUp(): void {
     parent::setUp();
 
     $this->moduleHandler = $this->createMock('\Drupal\Core\Extension\ModuleHandlerInterface');
@@ -52,7 +52,7 @@ public function setUp() {
         $this->pluginDefinition,
         $this->moduleHandler,
       ])
-      ->setMethods(['t'])
+      ->onlyMethods(['t'])
       ->getMock();
     $this->plugin->expects($this->any())
       ->method('t')
@@ -90,7 +90,7 @@ public function testGetConfiguration() {
    * @covers ::defaultConfiguration
    */
   public function testDefaultConfiguration() {
-    $this->assertInternalType('array', $this->plugin->defaultConfiguration());
+    $this->assertIsArray($this->plugin->defaultConfiguration());
   }
 
 }
diff --git a/web/modules/userprotect/userprotect.info.yml b/web/modules/userprotect/userprotect.info.yml
index e384e9eadd..bf495861a2 100644
--- a/web/modules/userprotect/userprotect.info.yml
+++ b/web/modules/userprotect/userprotect.info.yml
@@ -2,13 +2,13 @@ name: User Protect
 type: module
 description: 'Allows admins to protect users from being edited or cancelled, on a per-user basis.'
 core: 8.x
-core_version_requirement: ^8 || ^9
+core_version_requirement: ^8 || ^9 || ^10
 configure: userprotect.rule_list
 dependencies:
   - drupal:system (>=8.7.0)
   - drupal:user
 
-# Information added by Drupal.org packaging script on 2020-01-06
-version: '8.x-1.1'
+# Information added by Drupal.org packaging script on 2022-12-10
+version: '8.x-1.2'
 project: 'userprotect'
-datestamp: 1578341587
+datestamp: 1670669517
diff --git a/web/modules/userprotect/userprotect.module b/web/modules/userprotect/userprotect.module
index 72d069c5d3..6609ce7210 100644
--- a/web/modules/userprotect/userprotect.module
+++ b/web/modules/userprotect/userprotect.module
@@ -29,6 +29,12 @@ function userprotect_rule_load($name) {
  * Implements hook_ENTITY_TYPE_access() for entity type "user".
  */
 function userprotect_user_access(UserInterface $entity, $op, AccountInterface $account) {
+  // User Protect doesn't limit view access in any way, so bail out early to
+  // save time.
+  if (in_array($op, ['view', 'view label'])) {
+    return AccessResult::neutral();
+  }
+
   // Check if the account has the permission "userprotect.bypass_all".
   // If so, all protections rules should be ignored.
   if (!$account->hasPermission('userprotect.bypass_all')) {
-- 
GitLab