|
Moodle
2.2.1
http://www.collinsharper.com
|
00001 <?php 00002 require_once("$CFG->libdir/simpletest/portfolio_testclass.php"); 00003 require_once("$CFG->dirroot/mod/chat/lib.php"); 00004 00005 /* 00006 * TODO: The portfolio unit tests were obselete and did not work. 00007 * They have been commented out so that they do not break the 00008 * unit tests in Moodle 2. 00009 * 00010 * At some point: 00011 * 1. These tests should be audited to see which ones were valuable. 00012 * 2. The useful ones should be rewritten using the current standards 00013 * for writing test cases. 00014 * 00015 * This might be left until Moodle 2.1 when the test case framework 00016 * is due to change. 00017 */ 00018 Mock::generate('chat_portfolio_caller', 'mock_caller'); 00019 Mock::generate('portfolio_exporter', 'mock_exporter'); 00020 00021 class testChatPortfolioCallers extends portfoliolib_test { 00022 /* 00023 public static $includecoverage = array('lib/portfoliolib.php', 'mod/chat/lib.php'); 00024 public $module_type = 'chat'; 00025 public $modules = array(); 00026 public $entries = array(); 00027 public $caller; 00028 00029 public function setUp() { 00030 global $DB, $USER; 00031 00032 parent::setUp(); 00033 00034 $settings = array('quiet' => 1, 'pre_cleanup' => 1, 00035 'modules_list' => array($this->module_type), 00036 'number_of_students' => 15, 'students_per_course' => 15, 'number_of_sections' => 1, 00037 'number_of_modules' => 1, 'messages_per_chat' => 15); 00038 00039 generator_generate_data($settings); 00040 00041 $this->modules = $DB->get_records($this->module_type); 00042 $first_module = reset($this->modules); 00043 $cm = get_coursemodule_from_instance($this->module_type, $first_module->id); 00044 $userid = $DB->get_field('chat_users', 'userid', array('chatid' => $first_module->id)); 00045 00046 $this->caller = parent::setup_caller('chat_portfolio_caller', array('id' => $cm->id), $userid); 00047 } 00048 00049 public function test_caller_sha1() { 00050 $sha1 = $this->caller->get_sha1(); 00051 $this->caller->prepare_package(); 00052 $this->assertEqual($sha1, $this->caller->get_sha1()); 00053 } 00054 00055 public function test_caller_with_plugins() { 00056 parent::test_caller_with_plugins(); 00057 } 00058 */ 00059 }