Moodle  2.2.1
http://www.collinsharper.com
C:/xampp/htdocs/moodle/mod/glossary/simpletest/test_glossary_portfolio_callers.php
Go to the documentation of this file.
00001 <?php
00002 require_once("$CFG->libdir/simpletest/portfolio_testclass.php");
00003 require_once("$CFG->dirroot/mod/glossary/lib.php");
00004 require_once("$CFG->dirroot/mod/glossary/locallib.php");
00005 
00006 /*
00007  * TODO: The portfolio unit tests were obselete and did not work.
00008  * They have been commented out so that they do not break the
00009  * unit tests in Moodle 2.
00010  *
00011  * At some point:
00012  * 1. These tests should be audited to see which ones were valuable.
00013  * 2. The useful ones should be rewritten using the current standards
00014  *    for writing test cases.
00015  *
00016  * This might be left until Moodle 2.1 when the test case framework
00017  * is due to change.
00018  */
00019 Mock::generate('glossary_entry_portfolio_caller', 'mock_entry_caller');
00020 Mock::generate('glossary_csv_portfolio_caller', 'mock_csv_caller');
00021 Mock::generate('portfolio_exporter', 'mock_exporter');
00022 
00023 class testGlossaryPortfolioCallers extends portfoliolib_test {
00024 /*
00025     public static $includecoverage = array('lib/portfoliolib.php', 'mod/glossary/lib.php');
00026     public $glossaries = array();
00027     public $entries = array();
00028     public $entry_caller;
00029     public $csv_caller;
00030 
00031     public function setUp() {
00032         global $DB;
00033 
00034         parent::setUp();
00035         $settings = array('tiny' => 1, 'quiet' => 1, 'pre_cleanup' => 1,
00036                           'modules_list' => array('glossary'), 'entries_per_glossary' => 20,
00037                           'number_of_students' => 5, 'students_per_course' => 5, 'number_of_sections' => 1,
00038                           'number_of_modules' => 1, 'questions_per_course' => 0);
00039         generator_generate_data($settings);
00040 
00041         $this->glossaries = $DB->get_records('glossary');
00042         $first_glossary = reset($this->glossaries);
00043         $cm = get_coursemodule_from_instance('glossary', $first_glossary->id);
00044 
00045         $this->entries = $DB->get_records('glossary_entries', array('glossaryid' => $first_glossary->id));
00046         $first_entry = reset($this->entries);
00047 
00048         $callbackargs = array('id' => $cm->id, 'entryid' => $first_entry->id);
00049         $this->entry_caller = parent::setup_caller('glossary_entry_portfolio_caller', $callbackargs);
00050 
00051         $this->csv_caller = parent::setup_caller('glossary_csv_portfolio_caller', $callbackargs);
00052     }
00053 
00054     public function tearDown() {
00055         parent::tearDown();
00056     }
00057 
00058     public function test_entry_caller_sha1() {
00059         $entry_sha1 = $this->entry_caller->get_sha1();
00060         $this->entry_caller->prepare_package();
00061         $this->assertEqual($entry_sha1, $this->entry_caller->get_sha1());
00062     }
00063 
00064     public function test_csv_caller_sha1() {
00065         $csv_sha1 = $this->csv_caller->get_sha1();
00066         $this->csv_caller->prepare_package();
00067         $this->assertEqual($csv_sha1, $this->csv_caller->get_sha1());
00068     }
00069 
00070     public function test_caller_with_plugins() {
00071         parent::test_caller_with_plugins();
00072     }
00073 */
00074 }
 All Data Structures Namespaces Files Functions Variables Enumerations