From a992b742e318690e4afba8772207fc4b5b5a27da Mon Sep 17 00:00:00 2001 From: qadan Date: Thu, 26 Feb 2015 10:39:03 -0400 Subject: [PATCH 1/3] fix everyone yelling at me --- tests/includes/utilities.inc | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/tests/includes/utilities.inc b/tests/includes/utilities.inc index e12fab72..5d9501d1 100644 --- a/tests/includes/utilities.inc +++ b/tests/includes/utilities.inc @@ -314,7 +314,8 @@ class IslandoraTestUtilities extends IslandoraTestUtilityClass { * The user whose objects we'd like to remove. * * @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) { if ($username === $this->configuration['admin_user']) { @@ -330,16 +331,19 @@ SELECT ?object FROM <#ri> WHERE QUERY; $objects = $this->repository->ri->sparqlQuery($query); + $return_value = TRUE; foreach ($objects as $object) { $loaded_object = islandora_object_load($object['object']['value']); $this->repository->api->m->purgeObject($loaded_object->id); if (islandora_object_load($object['object']['value'])) { $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."); - return FALSE; + else { + $this->addResult(FALSE, "Unable to remove object {$object['object']['value']} from the repository."); + $return_value = FALSE; + } } + return $return_value; } /** From 6645c6901583eab653bd06821482f6ed3252700e Mon Sep 17 00:00:00 2001 From: qadan Date: Thu, 26 Feb 2015 10:42:33 -0400 Subject: [PATCH 2/3] unimportant commit, doesn't really change functionality any --- tests/includes/utilities.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/includes/utilities.inc b/tests/includes/utilities.inc index 5d9501d1..3d49936c 100644 --- a/tests/includes/utilities.inc +++ b/tests/includes/utilities.inc @@ -335,7 +335,7 @@ QUERY; foreach ($objects as $object) { $loaded_object = islandora_object_load($object['object']['value']); $this->repository->api->m->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."); } else { From d7b4a0de1e3fb2f8efa0c9c1863461935207ed79 Mon Sep 17 00:00:00 2001 From: qadan Date: Thu, 26 Feb 2015 10:45:39 -0400 Subject: [PATCH 3/3] can i get back to work now --- tests/includes/utilities.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/includes/utilities.inc b/tests/includes/utilities.inc index 3d49936c..4eef5255 100644 --- a/tests/includes/utilities.inc +++ b/tests/includes/utilities.inc @@ -334,7 +334,7 @@ QUERY; $return_value = TRUE; foreach ($objects as $object) { $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'])) { $this->addResult(TRUE, "Object {$object['object']['value']} successfully removed from repository."); }