MDL-15666 - fixing bugs in resource unit test implementation

This commit is contained in:
mjollnir_ 2008-09-15 16:08:59 +00:00
parent b2a9505b22
commit c50466705e
3 changed files with 5 additions and 2 deletions

View 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';

View 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));
}

View 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() {