]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-15666 - fixing bugs in resource unit test implementation
authormjollnir_ <mjollnir_>
Mon, 15 Sep 2008 16:08:59 +0000 (16:08 +0000)
committermjollnir_ <mjollnir_>
Mon, 15 Sep 2008 16:08:59 +0000 (16:08 +0000)
lang/en_utf8/resource.php
mod/resource/lib.php
mod/resource/simpletest/test_resource_portfolio_callers.php

index a9ead0d1253a4c77bc9aec6f649eb20a94da89d5..1120242fbf5e4dc19bf59e9a53dfc59c02741445 100644 (file)
@@ -98,7 +98,7 @@ $string['parameter'] = 'Parameter';
 $string['parameters'] = 'Parameters';
 $string['popupresource'] = 'This resource should appear in a popup window.';
 $string['popupresourcelink'] = 'If it didn\'t, click here: $a';
-$string['portfolionotimplemented'] = 'You are trying to export content from a resource type that doesn\'t support it!';
+$string['portfolionotimplemented'] = 'You are trying to export content from a resource type ($a) that doesn\'t support it!';
 $string['preview'] = 'Preview';
 $string['previous'] = 'Previous';
 $string['redeploy'] = 'Deploy again';
index 31e09fcf56c98b253407670d85082369da86fbfd..14f2b31a1c5ed8d66bf2786f71b16fdaa5288d3c 100644 (file)
@@ -727,6 +727,9 @@ class resource_portfolio_caller extends portfolio_module_caller_base {
         $this->resourcefile = $CFG->dirroot.'/mod/resource/type/'.$this->cm->type.'/resource.class.php';
         require_once($this->resourcefile);
         $this->resource= new $resourceclass($this->cm->id);
+        if (!is_callable(array($resource, 'portfolio_prepare_package')) || !is_callable(array($resource, 'portfolio_get_sha1'))) {
+            throw new portfolio_exception('portfolionotimplemented', 'resource', null, $this->cm->type);
+        }
         $this->supportedformats = array(self::type_to_format($this->cm->type));
     }
 
index b0f109edb9f70d5cf4ec923acbf9c228ce578d29..08e6de96d21e295c67d25f4bacc6b6041d9a2afd 100644 (file)
@@ -28,7 +28,7 @@ class testResourcePortfolioCallers extends portfoliolib_test {
         $first_module = reset($this->modules);
         $cm = get_coursemodule_from_instance($this->module_type, $first_module->id);
 
-        $this->caller = parent::setup_caller('resource_portfolio_caller', array('id' => $cm->id));
+        $this->caller = parent::setup_caller('resource_portfolio_caller', array('id' => $cm->instance));
     }
 
     public function tearDown() {