Browse Source

Merge ebc927345d into 1e935ce30a

pull/314/merge
daitken 13 years ago
parent
commit
6395cf1f6b
  1. 32
      tests/web_test_case.inc

32
tests/web_test_case.inc

@ -99,6 +99,21 @@ class IslandoraWebTestCase extends DrupalWebTestCase {
$this->admin->repository = $connection->repository; $this->admin->repository = $connection->repository;
return $this->admin; return $this->admin;
} }
/**
* Creates a temporary Drupal user with administrative privileges.
*
* @param array $permissions
* An optional set of different permissions to use (leave blank for all).
*/
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);
}
/** /**
* Stores the content of the Drupal Filter for later restoration. * Stores the content of the Drupal Filter for later restoration.
*/ */
@ -113,6 +128,23 @@ class IslandoraWebTestCase extends DrupalWebTestCase {
} }
} }
/**
* Gets the list of object PIDs owned by a user from the test database.
*
* @param string $user
* The user whose PIDs we want to grab
*
* @return array $objectpids
* Array storing PIDs found
*/
public function getPidListFromUser($user) {
$connection_info = Database::getConnectionInfo('default');
$dbname = $connection_info['default']['database'];
$query = "SELECT pid FROM $dbname.doFields WHERE ownerID = '$user'";
$objectpids = db_query($query);
return $objectpids;
}
/** /**
* Restores the original Drupal filter, frees any allocated resources. * Restores the original Drupal filter, frees any allocated resources.
* *

Loading…
Cancel
Save