Browse Source

Merge pull request #585 from qadan/7.x

Fix so that all user-generated objects are purged
pull/589/head
Jordan Dukart 10 years ago
parent
commit
b6854e3c96
  1. 16
      tests/includes/utilities.inc

16
tests/includes/utilities.inc

@ -314,7 +314,8 @@ class IslandoraTestUtilities extends IslandoraTestUtilityClass {
* The user whose objects we'd like to remove. * The user whose objects we'd like to remove.
* *
* @return bool * @return bool
* TRUE on success, FALSE on failure. * TRUE if all objects were removed, or FALSE if any of them still remained
* after removal.
*/ */
public function deleteUserCreatedObjects($username) { public function deleteUserCreatedObjects($username) {
if ($username === $this->configuration['admin_user']) { if ($username === $this->configuration['admin_user']) {
@ -330,16 +331,19 @@ SELECT ?object FROM <#ri> WHERE
QUERY; QUERY;
$objects = $this->repository->ri->sparqlQuery($query); $objects = $this->repository->ri->sparqlQuery($query);
$return_value = TRUE;
foreach ($objects as $object) { foreach ($objects as $object) {
$loaded_object = islandora_object_load($object['object']['value']); $loaded_object = islandora_object_load($object['object']['value']);
$this->repository->api->m->purgeObject($loaded_object->id); $this->repository->purgeObject($loaded_object->id);
if (islandora_object_load($object['object']['value'])) { if (!islandora_object_load($object['object']['value'])) {
$this->addResult(TRUE, "Object {$object['object']['value']} successfully removed from repository."); $this->addResult(TRUE, "Object {$object['object']['value']} successfully removed from repository.");
return TRUE;
} }
$this->addResult(FALSE, "Unable to remove object {$object['object']['value']} from the repository."); else {
return FALSE; $this->addResult(FALSE, "Unable to remove object {$object['object']['value']} from the repository.");
$return_value = FALSE;
}
} }
return $return_value;
} }
/** /**

Loading…
Cancel
Save