$entries = $DB->get_records('glossary_entries', array('glossaryid' => $this->glossary->id));
list($where, $params) = $DB->get_in_or_equal(array_keys($entries));
- $aliases = $DB->get_records_select('glossary_alias', 'entryid' . $where, $params);
+ $aliases = $DB->get_records_select('glossary_alias', 'entryid ' . $where, $params);
$categoryentries = $DB->get_records_sql('SELECT ec.entryid, c.name FROM {glossary_entries_categories} ec
JOIN {glossary_categories} c
ON c.id = ec.categoryid
--- /dev/null
+<?php // $Id$
+require_once($CFG->libdir.'/simpletest/testportfoliolib.php');
+require_once($CFG->dirroot.'/mod/glossary/lib.php');
+require_once($CFG->dirroot.'/admin/generator.php');
+
+Mock::generate('glossary_entry_portfolio_caller', 'mock_entry_caller');
+Mock::generate('glossary_csv_portfolio_caller', 'mock_csv_caller');
+Mock::generate('portfolio_exporter', 'mock_exporter');
+
+class testGlossaryPortfolioCallers extends portfoliolib_test {
+
+ public $glossaries = array();
+ public $entries = array();
+ public $entry_caller;
+ public $csv_caller;
+
+ public function setUp() {
+ global $DB;
+
+ parent::setUp();
+
+ $settings = array('tiny' => 1, 'quiet' => 1, 'database_prefix' => 'tst_', 'pre_cleanup' => 1,
+ 'modules_list' => array('glossary'), 'entries_per_glossary' => 20,
+ 'number_of_students' => 5, 'students_per_course' => 5, 'number_of_sections' => 1,
+ 'number_of_modules' => 1, 'questions_per_course' => 0);
+ generator_generate_data($settings);
+
+ $this->glossaries = $DB->get_records('glossary');
+ $first_glossary = reset($this->glossaries);
+ $cm = get_coursemodule_from_instance('glossary', $first_glossary->id);
+
+ $this->entries = $DB->get_records('glossary_entries', array('glossaryid' => $first_glossary->id));
+ $first_entry = reset($this->entries);
+
+ $callbackargs = array('id' => $cm->id, 'entryid' => $first_entry->id);
+ $this->entry_caller = new glossary_entry_portfolio_caller($callbackargs);
+ $this->entry_caller->set('exporter', new mock_exporter());
+ $this->csv_caller = new glossary_csv_portfolio_caller($callbackargs);
+ $this->csv_caller->set('exporter', new mock_exporter());
+ }
+
+ public function tearDown() {
+ parent::tearDown();
+ }
+
+ public function test_entry_caller_sha1() {
+ $entry_sha1 = $this->entry_caller->get_sha1();
+ $this->entry_caller->prepare_package();
+ $this->assertEqual($entry_sha1, $this->entry_caller->get_sha1());
+ }
+
+ public function test_csv_caller_sha1() {
+ $csv_sha1 = $this->csv_caller->get_sha1();
+ $this->csv_caller->prepare_package();
+ $this->assertEqual($csv_sha1, $this->csv_caller->get_sha1());
+ }
+}
+?>