You are here

function SchemaMetatagTestHelper::createAdminUser in Schema.org Metatag 7

Create an admin user for the tests.

Parameters

array $extra_permissions: An array of permission strings to be added to the user.

Return value

object A user object.

1 call to SchemaMetatagTestHelper::createAdminUser()
SchemaMetatagTagsTestBase::setUp in tests/schema_metatag.base.test
Sets up a Drupal site for running functional and integration tests.

File

tests/schema_metatag.helper.test, line 60

Class

SchemaMetatagTestHelper
A base class for the Metatag tests, provides shared methods.

Code

function createAdminUser($extra_permissions = array()) {
  $permissions = array(
    // Basic permissions for the module.
    'administer meta tags',
    'edit meta tags',
    // General admin access.
    'access administration pages',
  );

  // Reset the static variable used to identify permissions, otherwise it's
  // possible the permissions check in drupalCreateUser will fail.
  $this
    ->checkPermissions(array(), TRUE);
  cache_clear_all();
  return $this
    ->drupalCreateUser(array_merge($permissions, $extra_permissions));
}