MDL-15666 MDL-16177

Refactored the generator script into proper Object Oriented code. It can now be used as a CLI tool, as a web form or as an included library with a function call. Stub implementation is demonstrated in portfolio unit tests.
This commit is contained in:
nicolasconnault 2008-08-29 08:01:55 +00:00
parent d3919c2551
commit 7e95408b01
7 changed files with 728 additions and 545 deletions

View file

@ -129,13 +129,17 @@ class portfoliolib_test extends UnitTestCase {
$DB->delete_records('portfolio_tempdata', array('id' => $this->exporter->get('id')));
$fs = get_file_storage();
$fs->delete_area_files(SYSCONTEXTID, 'portfolio_exporter', $this->exporter->get('id'));
$settings = array('no_data' => 1, 'post_cleanup' => 1, 'database_prefix' => 'tst_', 'quiet' => 1);
generator_generate_data($settings);
}
function test_construct_dupe_instance() {
$gotexception = false;
try {
portfolio_plugin_base::create_instance('download', 'download1', array());
portfolio_plugin_base::create_instance('download', 'download2', array());
$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;