Proyectos de Subversion Moodle

Rev

Rev 1 | | Comparar con el anterior | Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
<?php
2
// This file is part of Moodle - http://moodle.org/
3
//
4
// Moodle is free software: you can redistribute it and/or modify
5
// it under the terms of the GNU General Public License as published by
6
// the Free Software Foundation, either version 3 of the License, or
7
// (at your option) any later version.
8
//
9
// Moodle is distributed in the hope that it will be useful,
10
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
// GNU General Public License for more details.
13
//
14
// You should have received a copy of the GNU General Public License
15
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
16
 
17
/**
18
 * The testable assign class.
19
 *
20
 * @package   mod_assign
21
 * @copyright 2014 Adrian Greeve <adrian@moodle.com>
22
 * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
23
 */
24
 
25
defined('MOODLE_INTERNAL') || die();
26
 
27
global $CFG;
28
require_once($CFG->dirroot . '/mod/assign/locallib.php');
29
 
30
/**
31
 * Test subclass that makes all the protected methods we want to test public.
32
 */
33
class mod_assign_testable_assign extends assign {
34
 
35
    public function testable_show_intro() {
36
        return parent::show_intro();
37
    }
38
 
39
    public function testable_delete_grades() {
40
        return parent::delete_grades();
41
    }
42
 
43
    public function testable_apply_grade_to_user($formdata, $userid, $attemptnumber) {
44
        return parent::apply_grade_to_user($formdata, $userid, $attemptnumber);
45
    }
46
 
47
    public function testable_get_grading_userid_list() {
48
        return parent::get_grading_userid_list();
49
    }
50
 
51
    public function testable_is_graded($userid) {
52
        return parent::is_graded($userid);
53
    }
54
 
55
    public function testable_update_submission(stdClass $submission, $userid, $updatetime, $teamsubmission) {
56
        return parent::update_submission($submission, $userid, $updatetime, $teamsubmission);
57
    }
58
 
59
    public function testable_process_add_attempt($userid = 0) {
60
        return parent::process_add_attempt($userid);
61
    }
62
 
63
    public function testable_process_save_quick_grades($postdata) {
64
        // Ugly hack to get something into the method.
65
        global $_POST;
66
        $_POST = $postdata;
67
        return parent::process_save_quick_grades();
68
    }
69
 
70
    public function testable_process_set_batch_marking_allocation($selectedusers, $markerid) {
71
        global $CFG;
72
        require_once($CFG->dirroot . '/mod/assign/batchsetallocatedmarkerform.php');
73
 
74
        // Simulate the form submission.
75
        $data = array();
76
        $data['id'] = $this->get_course_module()->id;
77
        $data['selectedusers'] = $selectedusers;
78
        $data['allocatedmarker'] = $markerid;
79
        $data['action'] = 'setbatchmarkingallocation';
80
        mod_assign_batch_set_allocatedmarker_form::mock_submit($data);
81
 
82
        return parent::process_set_batch_marking_allocation();
83
    }
84
 
85
    public function testable_process_set_batch_marking_workflow_state($selectedusers, $state) {
86
        global $CFG;
87
        require_once($CFG->dirroot . '/mod/assign/batchsetmarkingworkflowstateform.php');
88
 
89
        // Simulate the form submission.
90
        $data = array();
91
        $data['id'] = $this->get_course_module()->id;
92
        $data['selectedusers'] = $selectedusers;
93
        $data['markingworkflowstate'] = $state;
94
        $data['action'] = 'setbatchmarkingworkflowstate';
95
        mod_assign_batch_set_marking_workflow_state_form::mock_submit($data);
96
 
97
        return parent::process_set_batch_marking_workflow_state();
98
    }
99
 
100
    public function testable_submissions_open($userid = 0) {
101
        return parent::submissions_open($userid);
102
    }
103
 
104
    public function testable_save_user_extension($userid, $extensionduedate) {
105
        return parent::save_user_extension($userid, $extensionduedate);
106
    }
107
 
108
    public function testable_get_graders($userid) {
109
        // Changed method from protected to public.
110
        return parent::get_graders($userid);
111
    }
112
 
113
    public function testable_get_notifiable_users($userid) {
114
        return parent::get_notifiable_users($userid);
115
    }
116
 
117
    public function testable_view_batch_set_workflow_state($selectedusers) {
118
        global $PAGE;
119
        $PAGE->set_url('/mod/assign/view.php');
1441 ariadna 120
        $_POST['selectedusers'] = $selectedusers;
121
        return parent::view_batch_set_workflow_state();
1 efrain 122
    }
123
 
124
    public function testable_view_batch_markingallocation($selectedusers) {
125
        global $PAGE;
126
        $PAGE->set_url('/mod/assign/view.php');
1441 ariadna 127
        $_POST['selectedusers'] = $selectedusers;
128
        return parent::view_batch_markingallocation();
1 efrain 129
    }
130
 
131
    public function testable_update_activity_completion_records($teamsubmission,
132
                                                          $requireallteammemberssubmit,
133
                                                          $submission,
134
                                                          $userid,
135
                                                          $complete,
136
                                                          $completion) {
137
        return parent::update_activity_completion_records($teamsubmission,
138
                                                          $requireallteammemberssubmit,
139
                                                          $submission,
140
                                                          $userid,
141
                                                          $complete,
142
                                                          $completion);
143
    }
144
}