* Creates a temporary Drupal user with administrative privileges. This is much simpler than the probably-unnecessary process of determining the correct permissions for most tests.
*
* @param $permissions
* An array of permissions which the temporary admin user will adopt; should be left blank, as this will just pull all the permissions currently assigned to the Administrator role.
*
*/
public function createDrupalAdminUser(array $permissions = array()) {
$roles = user_roles();
$index = array_search('administrator', $roles);
$user = $this->drupalCreateUser($permissions);
$user->roles[$index] = 'administrator';
return user_save($user);
}
/**
* Creates a randomly generated child collection in the top-level collection through the testing interface. This should be used in lieu of throwing test objects into a standard collection, in case that collection has been deleted.
*
* @param $label
* The label that should be assigned to the collection
* @param $model
* The content model the collection should use
* @param $pid
* The PID that should be assigned to the collection (left blank by default, using a sequentially assigned number)
* Stores the content of the Drupal Filter for later restoration.
* Stores the content of the Drupal Filter for later restoration.
*/
*/
@ -113,6 +185,44 @@ class IslandoraWebTestCase extends DrupalWebTestCase {
}
}
}
}
/**
* Searches through the pages inside the root collection and opens the one specified by its label. This is much slower than doing it directly by PID; use this in tests where the PID is unknown.
* @param $label
* The label of the collection
*
*/
public function openRootTestCollectionByLabel($label, $index = 0) {