From c300933192558d35fdf888853e953231d637cf75 Mon Sep 17 00:00:00 2001 From: Alan Stanley Date: Wed, 16 Feb 2011 11:15:53 -0400 Subject: [PATCH] Changed in response to ISLANDORA-200 --- CollectionPolicy.inc | 4 ++-- XMLDatastream.inc | 10 ++++++++-- ilives/fedora_ilives.test | 33 --------------------------------- 3 files changed, 10 insertions(+), 37 deletions(-) delete mode 100644 ilives/fedora_ilives.test diff --git a/CollectionPolicy.inc b/CollectionPolicy.inc index 15a0392c..8997b42e 100644 --- a/CollectionPolicy.inc +++ b/CollectionPolicy.inc @@ -33,7 +33,7 @@ class CollectionPolicy extends XMLDatastream { static function loadFromCollection($pid, $preFetch=TRUE) { $ret = FALSE; module_load_include('inc', 'fedora_repository', 'api/fedora_item'); - + try { if (self::validPid($pid)) { $dsid=CollectionPolicy::getDefaultDSID(); @@ -133,7 +133,7 @@ class CollectionPolicy extends XMLDatastream { */ public static function ingestBlankPolicy($pid, $name, $policyDsid, $model_pid, $model_namespace, $relationship, $searchField, $searchValue) { $ret = FALSE; - if (($cp = self::loadFromCollection($pid, $modelDsid)) === FALSE) { + if (($cp = self::loadFromCollection($pid )) === FALSE) { //removed second, non-existant variable module_load_include('inc', 'fedora_repository', 'ContentModel'); if (($cm = ContentModel::loadFromModel($model_pid)) !== FALSE && $cm->validate()) { $newDom = new DOMDocument('1.0', 'utf-8'); diff --git a/XMLDatastream.inc b/XMLDatastream.inc index 3998582d..5bb149c9 100644 --- a/XMLDatastream.inc +++ b/XMLDatastream.inc @@ -92,11 +92,17 @@ abstract class XMLDatastream { */ public function __construct($xmlStr, $pid = NULL, $dsid = NULL) { libxml_use_internal_errors(true); + $this->pid = $pid; $this->dsid = $dsid; - if ($xmlStr !== NULL) { - $this->xml = (is_object($xmlStr) && get_class($xmlStr) == DOMDocument) ? $xmlStr : DOMDocument::loadXML($xmlStr); + if(is_object($xmlStr) && get_class($xmlStr) == 'DOMDocument'){ + $this->xml = $xmlStr; + }else{ + $this->xml = new DOMDocument('1.0', 'iso-8859-1'); + $this->xml->loadXML($xmlStr); + } + } } diff --git a/ilives/fedora_ilives.test b/ilives/fedora_ilives.test deleted file mode 100644 index 1923d45c..00000000 --- a/ilives/fedora_ilives.test +++ /dev/null @@ -1,33 +0,0 @@ - 'Fedora Ilives', - 'description' => t('The Fedora repository book module.'), - 'group' => t('fedora repository'), - ); - } - - protected function setUp() { - parent::setUp('fedora_ilives', 'fedora_repository'); - - - // Create and login user. - $drupal_user = $this->drupalCreateUser(array('add fedora datastreams', - 'edit fedora meta data', - 'edit tags datastream', - 'ingest new fedora objects', - 'purge objects and datastreams', - 'view fedora collection')); - - - $this->drupalLogin($drupal_user); - } - - public function testFedoraIlives() { - // Initially we are just testing that the module installs successfully from a clean Drupal. ISLANDORA-165. - $this->pass(drupal_get_path('module', 'fedora_ilives')); - - } -} \ No newline at end of file