You are here

public function SmsUserRulesWebTestCase::drupalCreateAdminUser in SMS Framework 7

Function that creates a user with the administrator role.

1 call to SmsUserRulesWebTestCase::drupalCreateAdminUser()
SmsUserRulesWebTestCase::testOptOutViaSmsAction in modules/sms_user/tests/sms_user.rules.test
Tests whether the opt out and opt in via sms rules actions work as they are supposed to.

File

modules/sms_user/tests/sms_user.rules.test, line 23

Class

SmsUserRulesWebTestCase
Provides common helper methods for SMS User Rules tests.

Code

public function drupalCreateAdminUser(array $permissions = array(
  'receive sms',
  'edit own sms number',
)) {
  $roles = user_roles();
  $index = array_search('administrator', $roles);
  $user = $this
    ->drupalCreateUser($permissions);
  $user->roles[$index] = 'administrator';
  return user_save($user);
}