1 backdrop_web_test_case.php protected BackdropWebTestCase::checkPermissions(array $permissions, $reset = FALSE)

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.:

File

core/modules/simpletest/backdrop_web_test_case.php, line 1398

Class

BackdropWebTestCase
Test case for typical Backdrop tests.

Code

protected function checkPermissions(array $permissions, $reset = FALSE) {
  $available = &backdrop_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;
}