Skip to content
Snippets Groups Projects
Commit 5dafc7fb authored by Michael Lee's avatar Michael Lee
Browse files

Merge branch 'userprotect' into lee5151

parents b6fd2c78 26ae3f89
No related branches found
No related tags found
No related merge requests found
Showing
with 144 additions and 121 deletions
......@@ -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"
......
......@@ -7648,21 +7648,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"
......@@ -7670,8 +7670,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"
......@@ -7684,13 +7684,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.",
......
......@@ -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(),
......
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>
......@@ -8,7 +8,7 @@
use Drupal\user\UserInterface;
/**
* Class UserProtectRoleAccessCheck.
* Defines an access control handler for user roles.
*
* @package Drupal\userprotect\Access
*/
......
......@@ -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
*/
......
......@@ -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
......@@ -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']);
......
......@@ -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.');
......
......@@ -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();
......
......@@ -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']]));
}
/**
......
......@@ -16,7 +16,7 @@ abstract class UserProtectBrowserTestBase extends BrowserTestBase {
/**
* {@inheritdoc}
*/
public static $modules = ['userprotect', 'userprotect_test'];
protected static $modules = ['userprotect', 'userprotect_test'];
/**
* {@inheritdoc}
......
......@@ -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);
}
}
......@@ -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);
}
......
......@@ -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());
}
/**
......
......@@ -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'
......
......@@ -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));
......
......@@ -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']);
}
......
......@@ -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());
}
}
......@@ -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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment