You are here

protected function SharedTestFunctions::drupalCreateAdminUser in Notify 7

5 calls to SharedTestFunctions::drupalCreateAdminUser()
TestNotify::setUp in ./notify.test
Sets up a Drupal site for running functional and integration tests.
TestNotifyBatch::setUp in ./notify.test
Sets up a Drupal site for running functional and integration tests.
TestNotifyMailSystem::setUp in ./notify.test
Sets up a Drupal site for running functional and integration tests.
TestNotifyPeriods::setUp in ./notify.test
Sets up a Drupal site for running functional and integration tests.
TestSendingHour::setUp in ./notify.test
Sets up a Drupal site for running functional and integration tests.

File

./notify.test, line 11
Automated tests for notify.

Class

SharedTestFunctions
@file Automated tests for notify.

Code

protected function drupalCreateAdminUser(array $permissions = array()) {
  $roles = user_roles();
  $index = array_search('administrator', $roles);
  $user = $this
    ->drupalCreateUser($permissions);
  $user->roles[$index] = 'administrator';

  // Subscribe this user to notifications,
  db_insert('notify')
    ->fields(array(
    'uid' => $user->uid,
    'status' => 1,
    'node' => 1,
    'teasers' => 0,
    'comment' => 1,
    'attempts' => 0,
  ))
    ->execute();
  return user_save($user);
}