Skip to content
Snippets Groups Projects
Commit f6312b85 authored by Angie Byron's avatar Angie Byron
Browse files

Issue #2202185 by Wim Leers, effulgentsia, msonnabaum, damiankloip, alexpott:...

Issue #2202185 by Wim Leers, effulgentsia, msonnabaum, damiankloip, alexpott: Statically cache Role entities to speed up (User|UserSession)::hasPermission().
parent 9528aedf
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
......@@ -28,6 +28,7 @@
* },
* admin_permission = "administer permissions",
* config_prefix = "role",
* static_cache = TRUE,
* entity_keys = {
* "id" = "id",
* "weight" = "weight",
......
......@@ -53,12 +53,11 @@ function testRoleAdministration() {
$this->assertRaw(t('The machine-readable name is already in use. It must be unique.'), 'Duplicate role warning displayed.');
// Test renaming a role.
$old_name = $role_name;
$role_name = '456';
$edit = array('label' => $role_name);
$this->drupalPostForm("admin/people/roles/manage/{$role->id()}", $edit, t('Save'));
$this->assertRaw(t('Role %label has been updated.', array('%label' => $role_name)));
$new_role = entity_load('user_role', $old_name);
$new_role = entity_load('user_role', $role->id(), TRUE);
$this->assertEqual($new_role->label(), $role_name, 'The role name has been successfully changed.');
// Test deleting a role.
......@@ -67,7 +66,7 @@ function testRoleAdministration() {
$this->drupalPostForm(NULL, array(), t('Delete'));
$this->assertRaw(t('Role %label has been deleted.', array('%label' => $role_name)));
$this->assertNoLinkByHref("admin/people/roles/manage/{$role->id()}", 'Role edit link removed.');
$this->assertFalse(entity_load('user_role', $role_name), 'A deleted role can no longer be loaded.');
$this->assertFalse(entity_load('user_role', $role->id(), TRUE), 'A deleted role can no longer be loaded.');
// Make sure that the system-defined roles can be edited via the user
// interface.
......
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