|
|
@ -93,7 +93,6 @@ class IslandoraWebTestCase extends DrupalWebTestCase { |
|
|
|
$roles = user_roles(); |
|
|
|
$roles = user_roles(); |
|
|
|
$index = array_search('administrator', $roles); |
|
|
|
$index = array_search('administrator', $roles); |
|
|
|
$user = $this->drupalCreateUser(); |
|
|
|
$user = $this->drupalCreateUser(); |
|
|
|
$this->drupalLogin($user); |
|
|
|
|
|
|
|
$user->roles[$index] = 'administrator'; |
|
|
|
$user->roles[$index] = 'administrator'; |
|
|
|
$user->name = $this->configuration['admin_user']; |
|
|
|
$user->name = $this->configuration['admin_user']; |
|
|
|
$user->pass = $this->configuration['admin_pass']; |
|
|
|
$user->pass = $this->configuration['admin_pass']; |
|
|
@ -104,6 +103,31 @@ class IslandoraWebTestCase extends DrupalWebTestCase { |
|
|
|
return $user; |
|
|
|
return $user; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Logs in the given user, handles the special case where the user is admin. |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @see DrupalWebTestCase::drupalLogin() |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
protected function drupalLogin(stdClass &$account) { |
|
|
|
|
|
|
|
if ($account->uid == $this->admin->uid) { |
|
|
|
|
|
|
|
// Create password for Drupal. |
|
|
|
|
|
|
|
$edit = array('pass' => user_password()); |
|
|
|
|
|
|
|
$account = user_save($account, $edit); |
|
|
|
|
|
|
|
// Raw password is used to login. |
|
|
|
|
|
|
|
$account->pass_raw = $edit['pass']; |
|
|
|
|
|
|
|
// We must login before changing the password for fedora. |
|
|
|
|
|
|
|
parent::drupalLogin($account); |
|
|
|
|
|
|
|
$account->name = $this->configuration['admin_user']; |
|
|
|
|
|
|
|
$account->pass = $this->configuration['admin_pass']; |
|
|
|
|
|
|
|
// Save the fedora admin credentials for later GET/POST requests. |
|
|
|
|
|
|
|
$account = user_save($account); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else { |
|
|
|
|
|
|
|
parent::drupalLogin($account); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Stores the content of the Drupal Filter for later restoration. |
|
|
|
* Stores the content of the Drupal Filter for later restoration. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|