From 251d8c9c47b236afbb5dbb227eddd0842992b005 Mon Sep 17 00:00:00 2001 From: qadan Date: Thu, 23 Apr 2015 16:07:02 -0300 Subject: [PATCH] a couple new utilities --- tests/includes/utilities.inc | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/tests/includes/utilities.inc b/tests/includes/utilities.inc index eefae4cc..f4925d6f 100644 --- a/tests/includes/utilities.inc +++ b/tests/includes/utilities.inc @@ -359,4 +359,36 @@ QUERY; return ($object instanceof FedoraObject); } + /** + * Asserts that the given PID represents a Fedora object. + * + * @param $pid + * The PID of the object. + * + * @return bool + * TRUE if the object exists in the repository; FALSE otherwise. + */ + public function assertObjectExists($pid) { + $object = islandora_object_load($pid); + $exists = $this->assertFedoraObject($pid); + $this->addResult($exists, "Object $pid exists in the repository."); + return $exists; + } + + /** + * Asserts that the given PID does not represent a Fedora object. + * + * @param $pid + * The PID of the object. + * + * @return bool + * TRUE if the object does not exist in the repository, or FALSE otherwise. + */ + public function assertNoObjectExists($pid) { + $object = islandora_object_load($pid); + $exists = $this->assertFedoraObject($pid); + $this->addResult(!$exists, "Object $pid does not exist in the repository."); + return !$exists; + } + }