protected function WebTestBase::checkPermissions

Check to make sure that the array of permissions are valid.

Parameters

$permissions: Permissions to check.

$reset: Reset cached available permissions.

Return value

TRUE or FALSE depending on whether the permissions are valid.

10 calls to WebTestBase::checkPermissions()
BlockTest::setUp in drupal/core/modules/block/lib/Drupal/block/Tests/BlockTest.php
Sets up a Drupal site for running functional and integration tests.
FilterDefaultFormatTest::resetFilterCaches in drupal/core/modules/filter/lib/Drupal/filter/Tests/FilterDefaultFormatTest.php
Rebuild text format and permission caches in the thread running the tests.
FilterFormatAccessTest::resetFilterCaches in drupal/core/modules/filter/lib/Drupal/filter/Tests/FilterFormatAccessTest.php
Rebuild text format and permission caches in the thread running the tests.
FilterHtmlImageSecureTest::setUp in drupal/core/modules/filter/lib/Drupal/filter/Tests/FilterHtmlImageSecureTest.php
Sets up a Drupal site for running functional and integration tests.
TextFieldTest::_testTextfieldWidgetsFormatted in drupal/core/modules/field/modules/text/lib/Drupal/text/Tests/TextFieldTest.php
Helper function for testTextfieldWidgetsFormatted().

... See full list

File

drupal/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php, line 525
Definition of Drupal\simpletest\WebTestBase.

Class

WebTestBase
Test case for typical Drupal tests.

Namespace

Drupal\simpletest

Code

protected function checkPermissions(array $permissions, $reset = FALSE) {
  $available =& drupal_static(__FUNCTION__);
  if (!isset($available) || $reset) {
    $available = array_keys(module_invoke_all('permission'));
  }
  $valid = TRUE;
  foreach ($permissions as $permission) {
    if (!in_array($permission, $available)) {
      $this
        ->fail(t('Invalid permission %permission.', array(
        '%permission' => $permission,
      )), t('Role'));
      $valid = FALSE;
    }
  }
  return $valid;
}