Moodle  2.2.1
http://www.collinsharper.com
C:/xampp/htdocs/moodle/mod/assignment/simpletest/test_assignment_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/assignment/lib.php");
00004 require_once("$CFG->dirroot/mod/assignment/locallib.php");
00005 
00006 Mock::generate('assignment_portfolio_caller', 'mock_caller');
00007 Mock::generate('portfolio_exporter', 'mock_exporter');
00008 
00009 
00010 class testAssignmentPortfolioCallers extends portfoliolib_test {
00011     public static $includecoverage = array('lib/portfoliolib.php', 'mod/assignment/lib.php');
00012     public $module_type = 'assignment';
00013     public $modules = array();
00014     public $entries = array();
00015     public $caller;
00016 
00017     /*
00018      * TODO: The portfolio unit tests were obselete and did not work.
00019      * They have been commented out so that they do not break the
00020      * unit tests in Moodle 2.
00021      *
00022      * At some point:
00023      * 1. These tests should be audited to see which ones were valuable.
00024      * 2. The useful ones should be rewritten using the current standards
00025      *    for writing test cases.
00026      *
00027      * This might be left until Moodle 2.1 when the test case framework
00028      * is due to change.
00029      * 
00030     public function setUp() {
00031         global $DB, $USER;
00032 
00033         parent::setUp();
00034         $assignment_types = new stdClass();
00035         $assignment_types->type = GENERATOR_SEQUENCE;
00036         $assignment_types->options = array('online');
00037 
00038         $settings = array('quiet' => 1,
00039                           'modules_list' => array($this->module_type), 'assignment_grades' => true,
00040                           'assignment_type' => $assignment_types,
00041                           'number_of_students' => 5, 'students_per_course' => 5, 'number_of_sections' => 1,
00042                           'number_of_modules' => 3, 'questions_per_course' => 0);
00043 
00044         generator_generate_data($settings);
00045 
00046         $this->modules = $DB->get_records($this->module_type);
00047         $first_module = reset($this->modules);
00048         $cm = get_coursemodule_from_instance($this->module_type, $first_module->id);
00049         $submissions = $DB->get_records('assignment_submissions', array('assignment' => $first_module->id));
00050         $first_submission = reset($submissions);
00051 
00052         $this->caller = parent::setup_caller('assignment_portfolio_caller', array('id' => $cm->id), $first_submission->userid);
00053     }
00054 
00055     public function tearDown() {
00056         parent::tearDown();
00057     }
00058 
00059     public function test_caller_sha1() {
00060         $sha1 = $this->caller->get_sha1();
00061         $this->caller->prepare_package();
00062         $this->assertEqual($sha1, $this->caller->get_sha1());
00063     }
00064 
00065     public function test_caller_with_plugins() {
00066         parent::test_caller_with_plugins();
00067     }
00068     */
00069 }
00070 
 All Data Structures Namespaces Files Functions Variables Enumerations