Issue #2256317 by sun: Remove static caching from WebTestBase::checkPermissions().

8.0.x
webchick 2014-05-04 00:32:35 -07:00
parent 971735da1a
commit 5d29f32449
11 changed files with 7 additions and 34 deletions

View File

@ -47,7 +47,6 @@ abstract class BlockTestBase extends WebTestBase {
'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.

View File

@ -61,8 +61,6 @@ class CommentTranslationUITest extends ContentTranslationUITest {
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);
}
/**

View File

@ -83,6 +83,5 @@ class FilterDefaultFormatTest extends WebTestBase {
*/
protected function resetFilterCaches() {
filter_formats_reset();
$this->checkPermissions(array(), TRUE);
}
}

View File

@ -330,6 +330,5 @@ class FilterFormatAccessTest extends WebTestBase {
*/
protected function resetFilterCaches() {
filter_formats_reset();
$this->checkPermissions(array(), TRUE);
}
}

View File

@ -55,7 +55,6 @@ class FilterHtmlImageSecureTest extends WebTestBase {
$filtered_html_format->save();
// Setup users.
$this->checkPermissions(array(), TRUE);
$this->web_user = $this->drupalCreateUser(array(
'access content',
'access comments',

View File

@ -247,9 +247,6 @@ abstract class RESTTestBase extends WebTestBase {
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');
}
/**

View File

@ -335,10 +335,6 @@ abstract class WebTestBase extends TestBase {
$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 @@ abstract class WebTestBase extends TestBase {
}
/**
* 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 @@ abstract class WebTestBase extends TestBase {
// Reset static variables and reload permissions.
$this->refreshVariables();
$this->checkPermissions(array(), TRUE);
}
/**

View File

@ -27,9 +27,6 @@ class VocabularyPermissionsTest extends TaxonomyTestBase {
// 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);

View File

@ -226,7 +226,6 @@ class TextFieldTest extends WebTestBase {
);
$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();

View File

@ -64,7 +64,6 @@ class UserSignatureTest extends WebTestBase {
$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'));

View File

@ -64,7 +64,6 @@ abstract class ViewTestBase extends WebTestBase {
$query->values($record);
}
$query->execute();
$this->checkPermissions(array(), TRUE);
}
/**