From 83960d6f02e6696dae238982fdee2a9eb7ca1043 Mon Sep 17 00:00:00 2001 From: qadan Date: Mon, 26 May 2014 15:22:49 -0300 Subject: [PATCH] better error handling --- tests/includes/datastream_validators.inc | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/tests/includes/datastream_validators.inc b/tests/includes/datastream_validators.inc index c0241c84..49c090e5 100644 --- a/tests/includes/datastream_validators.inc +++ b/tests/includes/datastream_validators.inc @@ -128,12 +128,17 @@ abstract class DatastreamValidator extends IslandoraTestUtilityClass { * fails to $this->passes and/or $this->fails. */ public function runValidators() { - $methods = get_class_methods($this); - foreach ($methods as $method) { - if (substr($method, 0, 6) === 'assert') { - $this->$method(); + if ($this->object[$this->datastream]) { + $methods = get_class_methods($this); + foreach ($methods as $method) { + if (substr($method, 0, 6) === 'assert') { + $this->$method(); + } } } + else { + $this->addResult(FALSE, "Unable to load the requested datastream {$this->datastream} from object {$this->object->id}."); + } } /**