/** * Construct a new exporter for use * * @param portfolio_plugin_base $instance portfolio instance (passed by reference) * @param portfolio_caller_base $caller portfolio caller (passed by reference) * @param string $callercomponent the name of the callercomponent */ public function __construct(&$instance, &$caller, $callercomponent) { $this->instance =& $instance; $this->caller =& $caller; if ($instance) { $this->instancefile = 'portfolio/' . $instance->get('plugin') . '/lib.php'; $this->instance->set('exporter', $this); } $this->callercomponent = $callercomponent; $this->stage = PORTFOLIO_STAGE_CONFIG; $this->caller->set('exporter', $this); $this->alreadystolen = array(); $this->newfilehashes = array(); }
function test_construct_dupe_instance() { $gotexception = false; try { $plugin1 = portfolio_plugin_base::create_instance('download', 'download1', array()); $plugin2 = portfolio_plugin_base::create_instance('download', 'download2', array()); $test1 = new portfolio_plugin_download($plugin1->get('id')); } catch (portfolio_exception $e) { $this->assertEqual('multipledisallowed', $e->errorcode); $gotexception = true; } $this->assertTrue($gotexception); }