diff --git a/core/modules/block/lib/Drupal/block/Tests/BlockTestBase.php b/core/modules/block/lib/Drupal/block/Tests/BlockTestBase.php index 88073c36d19fd26d4069249175f6adbebf7c3ba1..3ee504f1aa8ef0b15f5c99badfdd0ec3d553626c 100644 --- a/core/modules/block/lib/Drupal/block/Tests/BlockTestBase.php +++ b/core/modules/block/lib/Drupal/block/Tests/BlockTestBase.php @@ -47,7 +47,6 @@ function setUp() { 'name' => 'Full HTML', )); $full_html_format->save(); - $this->checkPermissions(array(), TRUE); // Create and log in an administrative user having access to the Full HTML // text format. diff --git a/core/modules/comment/lib/Drupal/comment/Tests/CommentTranslationUITest.php b/core/modules/comment/lib/Drupal/comment/Tests/CommentTranslationUITest.php index 5e5b4de702645d15cc2ee86ccc167c3a702bddbd..0fa07a3a5d1e547e3647cbc8c075c8dcc91c3b15 100644 --- a/core/modules/comment/lib/Drupal/comment/Tests/CommentTranslationUITest.php +++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentTranslationUITest.php @@ -61,8 +61,6 @@ function setupBundle() { content_translation_set_config('comment', 'node__comment_article', 'enabled', TRUE); // Refresh entity info. entity_info_cache_clear(); - // Flush the permissions after adding the translatable comment bundle. - $this->checkPermissions(array(), TRUE); } /** diff --git a/core/modules/filter/lib/Drupal/filter/Tests/FilterDefaultFormatTest.php b/core/modules/filter/lib/Drupal/filter/Tests/FilterDefaultFormatTest.php index b9b6b7114565762757afe856e92f198823faa4a1..bff71aa5ec0faacb479f8adff4ebac680af8ba81 100644 --- a/core/modules/filter/lib/Drupal/filter/Tests/FilterDefaultFormatTest.php +++ b/core/modules/filter/lib/Drupal/filter/Tests/FilterDefaultFormatTest.php @@ -83,6 +83,5 @@ function testDefaultTextFormats() { */ protected function resetFilterCaches() { filter_formats_reset(); - $this->checkPermissions(array(), TRUE); } } diff --git a/core/modules/filter/lib/Drupal/filter/Tests/FilterFormatAccessTest.php b/core/modules/filter/lib/Drupal/filter/Tests/FilterFormatAccessTest.php index 6550ffdbea6d12480fef56a13af5ab4c83b9b95c..c0aeb26ef9471d0924e35c7f10e2f49cd1d8efae 100644 --- a/core/modules/filter/lib/Drupal/filter/Tests/FilterFormatAccessTest.php +++ b/core/modules/filter/lib/Drupal/filter/Tests/FilterFormatAccessTest.php @@ -330,6 +330,5 @@ function testFormatWidgetPermissions() { */ protected function resetFilterCaches() { filter_formats_reset(); - $this->checkPermissions(array(), TRUE); } } diff --git a/core/modules/filter/lib/Drupal/filter/Tests/FilterHtmlImageSecureTest.php b/core/modules/filter/lib/Drupal/filter/Tests/FilterHtmlImageSecureTest.php index bc6d8bb0ba0986a6230dbf6c630a2857de8214a0..c5b5e0d60766a1cef3a937c9491a0784d1b22d3f 100644 --- a/core/modules/filter/lib/Drupal/filter/Tests/FilterHtmlImageSecureTest.php +++ b/core/modules/filter/lib/Drupal/filter/Tests/FilterHtmlImageSecureTest.php @@ -55,7 +55,6 @@ function setUp() { $filtered_html_format->save(); // Setup users. - $this->checkPermissions(array(), TRUE); $this->web_user = $this->drupalCreateUser(array( 'access content', 'access comments', diff --git a/core/modules/rest/lib/Drupal/rest/Tests/RESTTestBase.php b/core/modules/rest/lib/Drupal/rest/Tests/RESTTestBase.php index fdf56d942cbce526b565c61a81ada3c7c6430693..1e19be2d5dc6ff00dea93b0ce66ccd9a673aedc8 100644 --- a/core/modules/rest/lib/Drupal/rest/Tests/RESTTestBase.php +++ b/core/modules/rest/lib/Drupal/rest/Tests/RESTTestBase.php @@ -247,9 +247,6 @@ protected function enableService($resource_type, $method = 'GET', $format = NULL protected function rebuildCache() { // Rebuild routing cache, so that the REST API paths are available. $this->container->get('router.builder')->rebuild(); - // Reset the Simpletest permission cache, so that the new resource - // permissions get picked up. - drupal_static_reset('checkPermissions'); } /** diff --git a/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php b/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php index 12c54e529e546d1a821d69a56d66bbc550158a00..b91aeb627c736168e321ab9b81bae1e567cb07d4 100644 --- a/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php +++ b/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php @@ -335,10 +335,6 @@ protected function drupalCreateContentType(array $values = array()) { $this->assertEqual($status, SAVED_NEW, String::format('Created content type %type.', array('%type' => $type->id()))); - // Reset permissions so that permissions for this content type are - // available. - $this->checkPermissions(array(), TRUE); - return $type; } @@ -663,23 +659,16 @@ protected function drupalCreateRole(array $permissions, $rid = NULL, $name = NUL } /** - * Check to make sure that the array of permissions are valid. + * Checks whether a given list of permission names is valid. * - * @param $permissions - * Permissions to check. - * @param $reset - * Reset cached available permissions. + * @param array $permissions + * The permission names to check. * - * @return - * TRUE or FALSE depending on whether the permissions are valid. + * @return bool + * TRUE if the permissions are valid, FALSE otherwise. */ - protected function checkPermissions(array $permissions, $reset = FALSE) { - $available = &drupal_static(__FUNCTION__); - - if (!isset($available) || $reset) { - $available = array_keys(\Drupal::moduleHandler()->invokeAll('permission')); - } - + protected function checkPermissions(array $permissions) { + $available = array_keys(\Drupal::moduleHandler()->invokeAll('permission')); $valid = TRUE; foreach ($permissions as $permission) { if (!in_array($permission, $available)) { @@ -1132,7 +1121,6 @@ protected function resetAll() { // Reset static variables and reload permissions. $this->refreshVariables(); - $this->checkPermissions(array(), TRUE); } /** diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/VocabularyPermissionsTest.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/VocabularyPermissionsTest.php index 7b898020f7f6dd31472e97e04873763ba9126ded..6ed3e093690fe753cda38f2ee5a5a62a29e32c0d 100644 --- a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/VocabularyPermissionsTest.php +++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/VocabularyPermissionsTest.php @@ -27,9 +27,6 @@ function testVocabularyPermissionsTaxonomyTerm() { // Vocabulary used for creating, removing and editing terms. $vocabulary = $this->createVocabulary(); - // Reset to permission static cache to get proper permissions. - $this->checkPermissions(array(), TRUE); - // Test as admin user. $user = $this->drupalCreateUser(array('administer taxonomy')); $this->drupalLogin($user); diff --git a/core/modules/text/lib/Drupal/text/Tests/TextFieldTest.php b/core/modules/text/lib/Drupal/text/Tests/TextFieldTest.php index aecf2574f1837ca4885fd79dd4cc974f6e9feb23..62a2ed4ca9b37a582dab4711a131225f3597a640 100644 --- a/core/modules/text/lib/Drupal/text/Tests/TextFieldTest.php +++ b/core/modules/text/lib/Drupal/text/Tests/TextFieldTest.php @@ -226,7 +226,6 @@ function _testTextfieldWidgetsFormatted($field_type, $widget_type) { ); $this->drupalPostForm('admin/config/content/formats/add', $edit, t('Save configuration')); filter_formats_reset(); - $this->checkPermissions(array(), TRUE); $format = entity_load('filter_format', $edit['format']); $format_id = $format->format; $permission = $format->getPermissionName(); diff --git a/core/modules/user/lib/Drupal/user/Tests/UserSignatureTest.php b/core/modules/user/lib/Drupal/user/Tests/UserSignatureTest.php index 74a17122d2e8a6c09d71eea8849fab74425bfe9a..83f597367191f6c061ce999a1029c5fe4dac7780 100644 --- a/core/modules/user/lib/Drupal/user/Tests/UserSignatureTest.php +++ b/core/modules/user/lib/Drupal/user/Tests/UserSignatureTest.php @@ -64,7 +64,6 @@ function setUp() { $this->full_html_format->save(); user_role_grant_permissions(DRUPAL_AUTHENTICATED_RID, array($this->filtered_html_format->getPermissionName())); - $this->checkPermissions(array(), TRUE); // Create regular and administrative users. $this->web_user = $this->drupalCreateUser(array('post comments')); diff --git a/core/modules/views/lib/Drupal/views/Tests/ViewTestBase.php b/core/modules/views/lib/Drupal/views/Tests/ViewTestBase.php index 4ed9064f9e16515c14292206da91a409a9fd81b3..9b677ee4b06cd8142175b595a540ab93239ca24f 100644 --- a/core/modules/views/lib/Drupal/views/Tests/ViewTestBase.php +++ b/core/modules/views/lib/Drupal/views/Tests/ViewTestBase.php @@ -64,7 +64,6 @@ protected function enableViewsTestModule() { $query->values($record); } $query->execute(); - $this->checkPermissions(array(), TRUE); } /**