Commit | Line | Data |
---|---|---|
47f48152 DW |
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 | * Unit tests for (some of) mod/assign/locallib.php. | |
19 | * | |
20 | * @package mod_assign | |
21 | * @category phpunit | |
22 | * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com} | |
23 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | |
24 | */ | |
25 | ||
26 | ||
27 | defined('MOODLE_INTERNAL') || die(); | |
28 | ||
29 | global $CFG; | |
30 | require_once($CFG->dirroot . '/mod/assign/locallib.php'); | |
31 | require_once($CFG->dirroot . '/mod/assign/upgradelib.php'); | |
9c986ee0 | 32 | require_once($CFG->dirroot . '/mod/assign/tests/base_test.php'); |
47f48152 DW |
33 | |
34 | /** | |
35 | * Unit tests for (some of) mod/assign/locallib.php. | |
36 | * | |
37 | * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com} | |
38 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | |
39 | */ | |
9c986ee0 | 40 | class mod_assign_locallib_testcase extends mod_assign_base_testcase { |
47f48152 DW |
41 | |
42 | public function test_return_links() { | |
c2114099 | 43 | global $PAGE; |
47f48152 DW |
44 | $this->setUser($this->editingteachers[0]); |
45 | $returnaction = 'RETURNACTION'; | |
c2114099 | 46 | $returnparams = array('param'=>'1'); |
47f48152 | 47 | $assign = $this->create_instance(); |
c2114099 | 48 | $PAGE->set_url(new moodle_url('/mod/assign/view.php', array('id' => $assign->get_course_module()->id))); |
47f48152 DW |
49 | $assign->register_return_link($returnaction, $returnparams); |
50 | $this->assertEquals($returnaction, $assign->get_return_action()); | |
51 | $this->assertEquals($returnparams, $assign->get_return_params()); | |
52 | } | |
53 | ||
54 | public function test_get_feedback_plugins() { | |
55 | $this->setUser($this->editingteachers[0]); | |
56 | $assign = $this->create_instance(); | |
bd3b3bba | 57 | $installedplugins = array_keys(core_component::get_plugin_list('assignfeedback')); |
11527706 DW |
58 | |
59 | foreach ($assign->get_feedback_plugins() as $plugin) { | |
60 | $this->assertContains($plugin->get_type(), $installedplugins, 'Feedback plugin not in list of installed plugins'); | |
61 | } | |
47f48152 DW |
62 | } |
63 | ||
64 | public function test_get_submission_plugins() { | |
65 | $this->setUser($this->editingteachers[0]); | |
66 | $assign = $this->create_instance(); | |
bd3b3bba | 67 | $installedplugins = array_keys(core_component::get_plugin_list('assignsubmission')); |
11527706 DW |
68 | |
69 | foreach ($assign->get_submission_plugins() as $plugin) { | |
70 | $this->assertContains($plugin->get_type(), $installedplugins, 'Submission plugin not in list of installed plugins'); | |
71 | } | |
47f48152 DW |
72 | } |
73 | ||
74 | public function test_is_blind_marking() { | |
75 | $this->setUser($this->editingteachers[0]); | |
76 | $assign = $this->create_instance(array('blindmarking'=>1)); | |
77 | $this->assertEquals(true, $assign->is_blind_marking()); | |
78 | ||
79 | // Test cannot see student names. | |
80 | $gradingtable = new assign_grading_table($assign, 1, '', 0, true); | |
81 | $output = $assign->get_renderer()->render($gradingtable); | |
82 | $this->assertEquals(true, strpos($output, get_string('hiddenuser', 'assign'))); | |
83 | ||
84 | // Test students cannot reveal identities. | |
85 | $nopermission = false; | |
86 | $this->setUser($this->students[0]); | |
87 | $this->setExpectedException('required_capability_exception'); | |
88 | $assign->testable_process_reveal_identities(); | |
89 | ||
90 | // Test teachers cannot reveal identities. | |
91 | $nopermission = false; | |
92 | $this->setUser($this->teachers[0]); | |
93 | $this->setExpectedException('required_capability_exception'); | |
94 | $assign->testable_process_reveal_identities(); | |
95 | ||
96 | // Test sesskey is required. | |
47f48152 DW |
97 | $this->setUser($this->editingteachers[0]); |
98 | $this->setExpectedException('moodle_exception'); | |
99 | $assign->testable_process_reveal_identities(); | |
100 | ||
101 | // Test editingteacher can reveal identities if sesskey is ignored. | |
102 | $this->editingteachers[0]->ignoresesskey = true; | |
103 | $this->setUser($this->editingteachers[0]); | |
104 | $assign->testable_process_reveal_identities(); | |
105 | $this->assertEquals(false, $assign->is_blind_marking()); | |
106 | ||
107 | // Test student names are visible. | |
108 | $gradingtable = new assign_grading_table($assign, 1, '', 0, true); | |
109 | $output = $assign->get_renderer()->render($gradingtable); | |
110 | $this->assertEquals(false, strpos($output, get_string('hiddenuser', 'assign'))); | |
111 | ||
112 | // Set this back to default. | |
113 | $this->editingteachers[0]->ignoresesskey = false; | |
114 | } | |
115 | ||
116 | public function test_show_intro() { | |
117 | // Test whether we are showing the intro at the correct times. | |
118 | $this->setUser($this->editingteachers[0]); | |
119 | $assign = $this->create_instance(array('alwaysshowdescription'=>1)); | |
120 | ||
121 | $this->assertEquals(true, $assign->testable_show_intro()); | |
122 | ||
123 | $tomorrow = time() + (24*60*60); | |
124 | ||
125 | $assign = $this->create_instance(array('alwaysshowdescription'=>0, | |
126 | 'allowsubmissionsfromdate'=>$tomorrow)); | |
127 | $this->assertEquals(false, $assign->testable_show_intro()); | |
128 | $yesterday = time() - (24*60*60); | |
129 | $assign = $this->create_instance(array('alwaysshowdescription'=>0, | |
130 | 'allowsubmissionsfromdate'=>$yesterday)); | |
131 | $this->assertEquals(true, $assign->testable_show_intro()); | |
132 | } | |
133 | ||
134 | public function test_has_submissions_or_grades() { | |
135 | $this->setUser($this->editingteachers[0]); | |
136 | $assign = $this->create_instance(array('assignsubmission_onlinetext_enabled'=>1)); | |
137 | ||
138 | $instance = $assign->get_instance(); | |
139 | ||
140 | // Should start empty. | |
141 | $this->assertEquals(false, $assign->has_submissions_or_grades()); | |
142 | ||
143 | // Simulate a submission. | |
144 | $this->setUser($this->students[0]); | |
145 | $submission = $assign->get_user_submission($this->students[0]->id, true); | |
146 | $data = new stdClass(); | |
147 | $data->onlinetext_editor = array('itemid'=>file_get_unused_draft_itemid(), | |
148 | 'text'=>'Submission text', | |
149 | 'format'=>FORMAT_MOODLE); | |
150 | $plugin = $assign->get_submission_plugin_by_type('onlinetext'); | |
151 | $plugin->save($submission, $data); | |
152 | ||
153 | // Now test again. | |
154 | $this->assertEquals(true, $assign->has_submissions_or_grades()); | |
155 | // Set this back to default. | |
156 | $this->students[0]->ignoresesskey = false; | |
157 | } | |
158 | ||
159 | public function test_delete_grades() { | |
160 | $this->setUser($this->editingteachers[0]); | |
161 | $assign = $this->create_instance(); | |
162 | ||
163 | // Simulate adding a grade. | |
164 | $this->setUser($this->teachers[0]); | |
165 | $data = new stdClass(); | |
166 | $data->grade = '50.0'; | |
df211804 | 167 | $assign->testable_apply_grade_to_user($data, $this->students[0]->id, 0); |
47f48152 DW |
168 | |
169 | // Now see if the data is in the gradebook. | |
170 | $gradinginfo = grade_get_grades($this->course->id, | |
171 | 'mod', | |
172 | 'assign', | |
173 | $assign->get_instance()->id); | |
174 | ||
175 | $this->assertNotEquals(0, count($gradinginfo->items)); | |
176 | ||
177 | $assign->testable_delete_grades(); | |
178 | $gradinginfo = grade_get_grades($this->course->id, | |
179 | 'mod', | |
180 | 'assign', | |
181 | $assign->get_instance()->id); | |
182 | ||
183 | $this->assertEquals(0, count($gradinginfo->items)); | |
184 | } | |
185 | ||
186 | public function test_delete_instance() { | |
187 | $this->setUser($this->editingteachers[0]); | |
188 | $assign = $this->create_instance(array('assignsubmission_onlinetext_enabled'=>1)); | |
189 | ||
190 | // Simulate adding a grade. | |
191 | $this->setUser($this->teachers[0]); | |
192 | $data = new stdClass(); | |
193 | $data->grade = '50.0'; | |
df211804 | 194 | $assign->testable_apply_grade_to_user($data, $this->students[0]->id, 0); |
47f48152 DW |
195 | |
196 | // Simulate a submission. | |
197 | $this->setUser($this->students[0]); | |
198 | $submission = $assign->get_user_submission($this->students[0]->id, true); | |
199 | $data = new stdClass(); | |
200 | $data->onlinetext_editor = array('itemid'=>file_get_unused_draft_itemid(), | |
201 | 'text'=>'Submission text', | |
202 | 'format'=>FORMAT_MOODLE); | |
203 | $plugin = $assign->get_submission_plugin_by_type('onlinetext'); | |
204 | $plugin->save($submission, $data); | |
205 | ||
206 | // Now try and delete. | |
207 | $this->assertEquals(true, $assign->delete_instance()); | |
208 | } | |
209 | ||
210 | public function test_reset_userdata() { | |
211 | global $DB; | |
212 | ||
213 | $now = time(); | |
214 | $this->setUser($this->editingteachers[0]); | |
215 | $assign = $this->create_instance(array('assignsubmission_onlinetext_enabled'=>1, | |
216 | 'duedate'=>$now)); | |
217 | ||
218 | // Simulate adding a grade. | |
219 | $this->setUser($this->teachers[0]); | |
220 | $data = new stdClass(); | |
221 | $data->grade = '50.0'; | |
df211804 | 222 | $assign->testable_apply_grade_to_user($data, $this->students[0]->id, 0); |
47f48152 DW |
223 | |
224 | // Simulate a submission. | |
225 | $this->setUser($this->students[0]); | |
226 | $submission = $assign->get_user_submission($this->students[0]->id, true); | |
227 | $data = new stdClass(); | |
228 | $data->onlinetext_editor = array('itemid'=>file_get_unused_draft_itemid(), | |
229 | 'text'=>'Submission text', | |
230 | 'format'=>FORMAT_MOODLE); | |
231 | $plugin = $assign->get_submission_plugin_by_type('onlinetext'); | |
232 | $plugin->save($submission, $data); | |
233 | ||
234 | $this->assertEquals(true, $assign->has_submissions_or_grades()); | |
235 | // Now try and reset. | |
236 | $data = new stdClass(); | |
237 | $data->reset_assign_submissions = 1; | |
238 | $data->reset_gradebook_grades = 1; | |
239 | $data->courseid = $this->course->id; | |
240 | $data->timeshift = 24*60*60; | |
241 | $this->setUser($this->editingteachers[0]); | |
242 | $assign->reset_userdata($data); | |
243 | $this->assertEquals(false, $assign->has_submissions_or_grades()); | |
244 | ||
245 | // Reload the instance data. | |
246 | $instance = $DB->get_record('assign', array('id'=>$assign->get_instance()->id)); | |
247 | $this->assertEquals($now + 24*60*60, $instance->duedate); | |
248 | } | |
249 | ||
250 | public function test_plugin_settings() { | |
251 | global $DB; | |
252 | ||
253 | $now = time(); | |
254 | $this->setUser($this->editingteachers[0]); | |
255 | $assign = $this->create_instance(array('assignsubmission_file_enabled'=>1, | |
256 | 'assignsubmission_file_maxfiles'=>12, | |
257 | 'assignsubmission_file_maxsizebytes'=>10)); | |
258 | ||
259 | $plugin = $assign->get_submission_plugin_by_type('file'); | |
260 | $this->assertEquals('12', $plugin->get_config('maxfilesubmissions')); | |
261 | } | |
262 | ||
263 | public function test_update_calendar() { | |
264 | global $DB; | |
265 | ||
266 | $now = time(); | |
267 | $this->setUser($this->editingteachers[0]); | |
268 | $assign = $this->create_instance(array('duedate'=>$now)); | |
269 | ||
270 | // See if there is an event in the calendar. | |
271 | $params = array('modulename'=>'assign', 'instance'=>$assign->get_instance()->id); | |
272 | $id = $DB->get_field('event', 'id', $params); | |
273 | ||
274 | $this->assertEquals(false, empty($id)); | |
275 | } | |
276 | ||
277 | public function test_update_instance() { | |
278 | global $DB; | |
279 | ||
280 | $this->setUser($this->editingteachers[0]); | |
281 | $assign = $this->create_instance(array('assignsubmission_onlinetext_enabled'=>1)); | |
282 | ||
283 | $now = time(); | |
284 | $instance = $assign->get_instance(); | |
285 | $instance->duedate = $now; | |
286 | $instance->instance = $instance->id; | |
287 | $instance->assignsubmission_onlinetext_enabled = 1; | |
47f48152 DW |
288 | |
289 | $assign->update_instance($instance); | |
290 | ||
291 | $instance = $DB->get_record('assign', array('id'=>$assign->get_instance()->id)); | |
292 | $this->assertEquals($now, $instance->duedate); | |
293 | } | |
294 | ||
8fd00a24 DW |
295 | public function test_cannot_submit_empty() { |
296 | global $PAGE; | |
297 | ||
298 | $this->setUser($this->editingteachers[0]); | |
299 | $assign = $this->create_instance(array('submissiondrafts'=>1)); | |
300 | ||
301 | $PAGE->set_url(new moodle_url('/mod/assign/view.php', array('id' => $assign->get_course_module()->id))); | |
302 | ||
303 | // Test you cannot see the submit button for an offline assignment regardless. | |
304 | $this->setUser($this->students[0]); | |
305 | $output = $assign->view_student_summary($this->students[0], true); | |
306 | $this->assertNotContains(get_string('submitassignment', 'assign'), $output, 'Can submit empty offline assignment'); | |
307 | ||
308 | // Test you cannot see the submit button for an online text assignment with no submission. | |
309 | $this->setUser($this->editingteachers[0]); | |
310 | $instance = $assign->get_instance(); | |
311 | $instance->instance = $instance->id; | |
312 | $instance->assignsubmission_onlinetext_enabled = 1; | |
313 | ||
314 | $assign->update_instance($instance); | |
315 | $this->setUser($this->students[0]); | |
316 | $output = $assign->view_student_summary($this->students[0], true); | |
317 | $this->assertNotContains(get_string('submitassignment', 'assign'), $output, 'Cannot submit empty onlinetext assignment'); | |
318 | ||
319 | // Simulate a submission. | |
320 | $submission = $assign->get_user_submission($this->students[0]->id, true); | |
321 | $data = new stdClass(); | |
322 | $data->onlinetext_editor = array('itemid'=>file_get_unused_draft_itemid(), | |
323 | 'text'=>'Submission text', | |
324 | 'format'=>FORMAT_MOODLE); | |
325 | $plugin = $assign->get_submission_plugin_by_type('onlinetext'); | |
326 | $plugin->save($submission, $data); | |
327 | // Test you can see the submit button for an online text assignment with a submission. | |
328 | $output = $assign->view_student_summary($this->students[0], true); | |
329 | $this->assertContains(get_string('submitassignment', 'assign'), $output, 'Can submit non empty onlinetext assignment'); | |
330 | } | |
331 | ||
47f48152 | 332 | public function test_list_participants() { |
df211804 | 333 | $this->create_extra_users(); |
47f48152 DW |
334 | $this->setUser($this->editingteachers[0]); |
335 | $assign = $this->create_instance(array('grade'=>100)); | |
336 | ||
a5c793c3 | 337 | $this->assertEquals(self::DEFAULT_STUDENT_COUNT + self::EXTRA_STUDENT_COUNT, count($assign->list_participants(null, true))); |
e6cc5347 RT |
338 | |
339 | // Teacher with user preference set should see suspended users as well. | |
340 | set_user_preference('grade_report_showonlyactiveenrol', false); | |
341 | $assign = $this->create_instance(array('grade'=>100)); | |
342 | $this->assertEquals(self::DEFAULT_STUDENT_COUNT + self::EXTRA_STUDENT_COUNT + self::EXTRA_SUSPENDED_COUNT, | |
343 | count($assign->list_participants(null, true))); | |
344 | ||
1ecb8044 | 345 | // Non-editing teacher should not see suspended users, even if user preference is set. |
e6cc5347 RT |
346 | $this->setUser($this->teachers[0]); |
347 | set_user_preference('grade_report_showonlyactiveenrol', false); | |
348 | $assign = $this->create_instance(array('grade'=>100)); | |
349 | $this->assertEquals(self::DEFAULT_STUDENT_COUNT + self::EXTRA_STUDENT_COUNT, count($assign->list_participants(null, true))); | |
47f48152 DW |
350 | } |
351 | ||
352 | public function test_count_teams() { | |
df211804 | 353 | $this->create_extra_users(); |
47f48152 DW |
354 | $this->setUser($this->editingteachers[0]); |
355 | $assign = $this->create_instance(array('teamsubmission'=>1)); | |
356 | ||
a5c793c3 | 357 | $this->assertEquals(self::GROUP_COUNT + 1, $assign->count_teams()); |
47f48152 DW |
358 | } |
359 | ||
360 | public function test_count_submissions() { | |
df211804 | 361 | $this->create_extra_users(); |
47f48152 DW |
362 | $this->setUser($this->editingteachers[0]); |
363 | $assign = $this->create_instance(array('assignsubmission_onlinetext_enabled'=>1)); | |
364 | ||
365 | // Simulate a submission. | |
a5c793c3 DW |
366 | $this->setUser($this->extrastudents[0]); |
367 | $submission = $assign->get_user_submission($this->extrastudents[0]->id, true); | |
47f48152 DW |
368 | // Leave this one as DRAFT. |
369 | $data = new stdClass(); | |
370 | $data->onlinetext_editor = array('itemid'=>file_get_unused_draft_itemid(), | |
371 | 'text'=>'Submission text', | |
372 | 'format'=>FORMAT_MOODLE); | |
373 | $plugin = $assign->get_submission_plugin_by_type('onlinetext'); | |
374 | $plugin->save($submission, $data); | |
375 | ||
376 | // Simulate adding a grade. | |
377 | $this->setUser($this->teachers[0]); | |
378 | $data = new stdClass(); | |
379 | $data->grade = '50.0'; | |
df211804 | 380 | $assign->testable_apply_grade_to_user($data, $this->extrastudents[0]->id, 0); |
47f48152 DW |
381 | |
382 | // Simulate a submission. | |
a5c793c3 DW |
383 | $this->setUser($this->extrastudents[1]); |
384 | $submission = $assign->get_user_submission($this->extrastudents[1]->id, true); | |
47f48152 | 385 | $submission->status = ASSIGN_SUBMISSION_STATUS_SUBMITTED; |
a5c793c3 | 386 | $assign->testable_update_submission($submission, $this->extrastudents[1]->id, true, false); |
47f48152 DW |
387 | $data = new stdClass(); |
388 | $data->onlinetext_editor = array('itemid'=>file_get_unused_draft_itemid(), | |
389 | 'text'=>'Submission text', | |
390 | 'format'=>FORMAT_MOODLE); | |
391 | $plugin = $assign->get_submission_plugin_by_type('onlinetext'); | |
392 | $plugin->save($submission, $data); | |
393 | ||
394 | // Simulate a submission. | |
a5c793c3 DW |
395 | $this->setUser($this->extrastudents[2]); |
396 | $submission = $assign->get_user_submission($this->extrastudents[2]->id, true); | |
47f48152 | 397 | $submission->status = ASSIGN_SUBMISSION_STATUS_SUBMITTED; |
a5c793c3 | 398 | $assign->testable_update_submission($submission, $this->extrastudents[2]->id, true, false); |
47f48152 DW |
399 | $data = new stdClass(); |
400 | $data->onlinetext_editor = array('itemid'=>file_get_unused_draft_itemid(), | |
401 | 'text'=>'Submission text', | |
402 | 'format'=>FORMAT_MOODLE); | |
403 | $plugin = $assign->get_submission_plugin_by_type('onlinetext'); | |
404 | $plugin->save($submission, $data); | |
405 | ||
406 | // Simulate a submission. | |
a5c793c3 DW |
407 | $this->setUser($this->extrastudents[3]); |
408 | $submission = $assign->get_user_submission($this->extrastudents[3]->id, true); | |
47f48152 | 409 | $submission->status = ASSIGN_SUBMISSION_STATUS_SUBMITTED; |
a5c793c3 | 410 | $assign->testable_update_submission($submission, $this->extrastudents[3]->id, true, false); |
47f48152 DW |
411 | $data = new stdClass(); |
412 | $data->onlinetext_editor = array('itemid'=>file_get_unused_draft_itemid(), | |
413 | 'text'=>'Submission text', | |
414 | 'format'=>FORMAT_MOODLE); | |
415 | $plugin = $assign->get_submission_plugin_by_type('onlinetext'); | |
416 | $plugin->save($submission, $data); | |
417 | ||
e6cc5347 RT |
418 | // Simulate a submission for suspended user, this will never be counted. |
419 | $this->setUser($this->extrastudents[3]); | |
420 | $submission = $assign->get_user_submission($this->extrasuspendedstudents[0]->id, true); | |
421 | $submission->status = ASSIGN_SUBMISSION_STATUS_SUBMITTED; | |
422 | $assign->testable_update_submission($submission, $this->extrasuspendedstudents[0]->id, true, false); | |
423 | $data = new stdClass(); | |
424 | $data->onlinetext_editor = array('itemid'=>file_get_unused_draft_itemid(), | |
425 | 'text'=>'Submission text', | |
426 | 'format'=>FORMAT_MOODLE); | |
427 | $plugin = $assign->get_submission_plugin_by_type('onlinetext'); | |
428 | $plugin->save($submission, $data); | |
429 | ||
47f48152 DW |
430 | // Simulate adding a grade. |
431 | $this->setUser($this->teachers[0]); | |
432 | $data = new stdClass(); | |
433 | $data->grade = '50.0'; | |
df211804 | 434 | $assign->testable_apply_grade_to_user($data, $this->extrastudents[3]->id, 0); |
e6cc5347 | 435 | $assign->testable_apply_grade_to_user($data, $this->extrasuspendedstudents[0]->id, 0); |
47f48152 DW |
436 | |
437 | $this->assertEquals(2, $assign->count_grades()); | |
438 | $this->assertEquals(4, $assign->count_submissions()); | |
439 | $this->assertEquals(2, $assign->count_submissions_need_grading()); | |
440 | $this->assertEquals(3, $assign->count_submissions_with_status(ASSIGN_SUBMISSION_STATUS_SUBMITTED)); | |
441 | $this->assertEquals(1, $assign->count_submissions_with_status(ASSIGN_SUBMISSION_STATUS_DRAFT)); | |
442 | } | |
443 | ||
444 | public function test_get_grading_userid_list() { | |
df211804 | 445 | $this->create_extra_users(); |
47f48152 DW |
446 | $this->setUser($this->editingteachers[0]); |
447 | $assign = $this->create_instance(); | |
448 | ||
449 | $users = $assign->testable_get_grading_userid_list(); | |
a5c793c3 | 450 | $this->assertEquals(self::DEFAULT_STUDENT_COUNT + self::EXTRA_STUDENT_COUNT, count($users)); |
e6cc5347 RT |
451 | |
452 | $this->setUser($this->editingteachers[0]); | |
453 | set_user_preference('grade_report_showonlyactiveenrol', false); | |
454 | $assign = $this->create_instance(); | |
455 | ||
456 | $users = $assign->testable_get_grading_userid_list(); | |
457 | $this->assertEquals(self::DEFAULT_STUDENT_COUNT + self::EXTRA_STUDENT_COUNT + self::EXTRA_SUSPENDED_COUNT, count($users)); | |
47f48152 DW |
458 | } |
459 | ||
460 | public function test_cron() { | |
461 | // First run cron so there are no messages waiting to be sent (from other tests). | |
462 | cron_setup_user(); | |
463 | assign::cron(); | |
464 | ||
465 | // Now create an assignment and add some feedback. | |
466 | $this->setUser($this->editingteachers[0]); | |
467 | $assign = $this->create_instance(); | |
468 | ||
469 | // Simulate adding a grade. | |
470 | $this->setUser($this->teachers[0]); | |
471 | $data = new stdClass(); | |
472 | $data->grade = '50.0'; | |
df211804 | 473 | $assign->testable_apply_grade_to_user($data, $this->students[0]->id, 0); |
47f48152 DW |
474 | |
475 | // Now run cron and see that one message was sent. | |
476 | $this->preventResetByRollback(); | |
477 | $sink = $this->redirectMessages(); | |
478 | cron_setup_user(); | |
479 | $this->expectOutputRegex('/Done processing 1 assignment submissions/'); | |
480 | assign::cron(); | |
481 | ||
482 | $messages = $sink->get_messages(); | |
483 | $this->assertEquals(1, count($messages)); | |
484 | $this->assertEquals(1, $messages[0]->notification); | |
485 | $this->assertEquals($assign->get_instance()->name, $messages[0]->contexturlname); | |
486 | } | |
487 | ||
488 | public function test_is_graded() { | |
489 | $this->setUser($this->editingteachers[0]); | |
490 | $assign = $this->create_instance(); | |
491 | ||
492 | // Simulate adding a grade. | |
493 | $this->setUser($this->teachers[0]); | |
494 | $data = new stdClass(); | |
495 | $data->grade = '50.0'; | |
df211804 | 496 | $assign->testable_apply_grade_to_user($data, $this->students[0]->id, 0); |
47f48152 DW |
497 | |
498 | $this->assertEquals(true, $assign->testable_is_graded($this->students[0]->id)); | |
499 | $this->assertEquals(false, $assign->testable_is_graded($this->students[1]->id)); | |
500 | } | |
501 | ||
502 | public function test_can_view_submission() { | |
e6cc5347 | 503 | $this->create_extra_users(); |
47f48152 DW |
504 | $this->setUser($this->editingteachers[0]); |
505 | $assign = $this->create_instance(); | |
506 | ||
507 | $this->setUser($this->students[0]); | |
508 | $this->assertEquals(true, $assign->can_view_submission($this->students[0]->id)); | |
509 | $this->assertEquals(false, $assign->can_view_submission($this->students[1]->id)); | |
510 | $this->assertEquals(false, $assign->can_view_submission($this->teachers[0]->id)); | |
511 | $this->setUser($this->teachers[0]); | |
512 | $this->assertEquals(true, $assign->can_view_submission($this->students[0]->id)); | |
513 | $this->assertEquals(true, $assign->can_view_submission($this->students[1]->id)); | |
514 | $this->assertEquals(true, $assign->can_view_submission($this->teachers[0]->id)); | |
e6cc5347 | 515 | $this->assertEquals(false, $assign->can_view_submission($this->extrasuspendedstudents[0]->id)); |
47f48152 DW |
516 | $this->setUser($this->editingteachers[0]); |
517 | $this->assertEquals(true, $assign->can_view_submission($this->students[0]->id)); | |
518 | $this->assertEquals(true, $assign->can_view_submission($this->students[1]->id)); | |
519 | $this->assertEquals(true, $assign->can_view_submission($this->teachers[0]->id)); | |
e6cc5347 | 520 | $this->assertEquals(true, $assign->can_view_submission($this->extrasuspendedstudents[0]->id)); |
47f48152 DW |
521 | } |
522 | ||
523 | ||
524 | public function test_update_submission() { | |
df211804 | 525 | $this->create_extra_users(); |
47f48152 DW |
526 | $this->setUser($this->editingteachers[0]); |
527 | $assign = $this->create_instance(); | |
528 | ||
a5c793c3 | 529 | $this->setUser($this->extrastudents[0]); |
47f48152 | 530 | $now = time(); |
a5c793c3 DW |
531 | $submission = $assign->get_user_submission($this->extrastudents[0]->id, true); |
532 | $assign->testable_update_submission($submission, $this->extrastudents[0]->id, true, false); | |
47f48152 DW |
533 | |
534 | $this->setUser($this->teachers[0]); | |
535 | // Verify the gradebook update. | |
536 | $gradinginfo = grade_get_grades($this->course->id, | |
537 | 'mod', | |
538 | 'assign', | |
539 | $assign->get_instance()->id, | |
a5c793c3 | 540 | $this->extrastudents[0]->id); |
47f48152 | 541 | |
a5c793c3 DW |
542 | $this->assertEquals($this->extrastudents[0]->id, |
543 | $gradinginfo->items[0]->grades[$this->extrastudents[0]->id]->usermodified); | |
47f48152 DW |
544 | |
545 | // Now verify group assignments. | |
546 | $this->setUser($this->editingteachers[0]); | |
547 | $assign = $this->create_instance(array('teamsubmission'=>1)); | |
548 | ||
a5c793c3 | 549 | $this->setUser($this->extrastudents[0]); |
47f48152 | 550 | $now = time(); |
a5c793c3 DW |
551 | $submission = $assign->get_group_submission($this->extrastudents[0]->id, 0, true); |
552 | $assign->testable_update_submission($submission, $this->extrastudents[0]->id, true, true); | |
47f48152 | 553 | |
e6cc5347 | 554 | // Check that at least 2 active members and 1 suspended member of the submission group had their submission updated. |
47f48152 DW |
555 | |
556 | $this->setUser($this->editingteachers[0]); | |
557 | $gradinginfo = grade_get_grades($this->course->id, | |
558 | 'mod', | |
559 | 'assign', | |
560 | $assign->get_instance()->id, | |
a5c793c3 | 561 | $this->extrastudents[0]->id); |
47f48152 | 562 | |
a5c793c3 DW |
563 | $this->assertEquals($this->extrastudents[0]->id, |
564 | $gradinginfo->items[0]->grades[$this->extrastudents[0]->id]->usermodified); | |
47f48152 DW |
565 | |
566 | $gradinginfo = grade_get_grades($this->course->id, | |
567 | 'mod', | |
568 | 'assign', | |
569 | $assign->get_instance()->id, | |
a5c793c3 | 570 | $this->extrastudents[self::GROUP_COUNT]->id); |
47f48152 | 571 | |
a5c793c3 DW |
572 | $this->assertEquals($this->extrastudents[self::GROUP_COUNT]->id, |
573 | $gradinginfo->items[0]->grades[$this->extrastudents[self::GROUP_COUNT]->id]->usermodified); | |
47f48152 | 574 | |
e6cc5347 RT |
575 | $gradinginfo = grade_get_grades($this->course->id, |
576 | 'mod', | |
577 | 'assign', | |
578 | $assign->get_instance()->id, | |
579 | $this->extrasuspendedstudents[0]->id); | |
580 | $this->assertEquals($this->extrasuspendedstudents[0]->id, | |
581 | $gradinginfo->items[0]->grades[$this->extrasuspendedstudents[0]->id]->usermodified); | |
582 | ||
583 | // Check the same with non-editing teacher and make sure submission is not updated for suspended user. | |
584 | $this->setUser($this->editingteachers[0]); | |
585 | $assign = $this->create_instance(array('teamsubmission'=>1)); | |
586 | ||
587 | $this->setUser($this->extrastudents[1]); | |
588 | $now = time(); | |
589 | $submission = $assign->get_group_submission($this->extrastudents[1]->id, 0, true); | |
590 | $assign->testable_update_submission($submission, $this->extrastudents[1]->id, true, true); | |
591 | ||
592 | $this->setUser($this->teachers[0]); | |
593 | $gradinginfo = grade_get_grades($this->course->id, | |
594 | 'mod', | |
595 | 'assign', | |
596 | $assign->get_instance()->id, | |
597 | $this->extrastudents[1]->id); | |
598 | ||
599 | $this->assertEquals($this->extrastudents[1]->id, | |
600 | $gradinginfo->items[0]->grades[$this->extrastudents[1]->id]->usermodified); | |
601 | ||
602 | $gradinginfo = grade_get_grades($this->course->id, | |
603 | 'mod', | |
604 | 'assign', | |
605 | $assign->get_instance()->id, | |
606 | $this->extrastudents[self::GROUP_COUNT+1]->id); | |
607 | ||
608 | $this->assertEquals($this->extrastudents[self::GROUP_COUNT+1]->id, | |
609 | $gradinginfo->items[0]->grades[$this->extrastudents[self::GROUP_COUNT+1]->id]->usermodified); | |
610 | ||
611 | $gradinginfo = grade_get_grades($this->course->id, | |
612 | 'mod', | |
613 | 'assign', | |
614 | $assign->get_instance()->id, | |
615 | $this->extrasuspendedstudents[1]->id); | |
616 | $this->assertEquals($this->extrasuspendedstudents[1]->id, | |
617 | $gradinginfo->items[0]->grades[$this->extrasuspendedstudents[1]->id]->usermodified); | |
618 | ||
47f48152 DW |
619 | // Now verify blind marking. |
620 | $this->setUser($this->editingteachers[0]); | |
621 | $assign = $this->create_instance(array('blindmarking'=>1)); | |
622 | ||
a5c793c3 | 623 | $this->setUser($this->extrastudents[0]); |
47f48152 | 624 | $now = time(); |
a5c793c3 DW |
625 | $submission = $assign->get_user_submission($this->extrastudents[0]->id, true); |
626 | $assign->testable_update_submission($submission, $this->extrastudents[0]->id, true, false); | |
47f48152 DW |
627 | |
628 | $this->setUser($this->editingteachers[0]); | |
629 | $gradinginfo = grade_get_grades($this->course->id, | |
630 | 'mod', | |
631 | 'assign', | |
632 | $assign->get_instance()->id, | |
a5c793c3 | 633 | $this->extrastudents[0]->id); |
47f48152 | 634 | |
a5c793c3 | 635 | $this->assertEquals(null, $gradinginfo->items[0]->grades[$this->extrastudents[0]->id]->datesubmitted); |
47f48152 DW |
636 | } |
637 | ||
638 | public function test_submissions_open() { | |
639 | $this->setUser($this->editingteachers[0]); | |
640 | ||
641 | $now = time(); | |
642 | $tomorrow = $now + 24*60*60; | |
643 | $oneweek = $now + 7*24*60*60; | |
644 | $yesterday = $now - 24*60*60; | |
645 | ||
646 | $assign = $this->create_instance(); | |
647 | $this->assertEquals(true, $assign->testable_submissions_open($this->students[0]->id)); | |
648 | ||
649 | $assign = $this->create_instance(array('duedate'=>$tomorrow)); | |
650 | $this->assertEquals(true, $assign->testable_submissions_open($this->students[0]->id)); | |
651 | ||
652 | $assign = $this->create_instance(array('duedate'=>$yesterday)); | |
653 | $this->assertEquals(true, $assign->testable_submissions_open($this->students[0]->id)); | |
654 | ||
655 | $assign = $this->create_instance(array('duedate'=>$yesterday, 'cutoffdate'=>$tomorrow)); | |
656 | $this->assertEquals(true, $assign->testable_submissions_open($this->students[0]->id)); | |
657 | ||
658 | $assign = $this->create_instance(array('duedate'=>$yesterday, 'cutoffdate'=>$yesterday)); | |
659 | $this->assertEquals(false, $assign->testable_submissions_open($this->students[0]->id)); | |
660 | ||
661 | $assign->testable_save_user_extension($this->students[0]->id, $tomorrow); | |
662 | $this->assertEquals(true, $assign->testable_submissions_open($this->students[0]->id)); | |
663 | ||
664 | $assign = $this->create_instance(array('submissiondrafts'=>1)); | |
665 | $this->assertEquals(true, $assign->testable_submissions_open($this->students[0]->id)); | |
666 | ||
667 | $this->setUser($this->students[0]); | |
668 | $now = time(); | |
669 | $submission = $assign->get_user_submission($this->students[0]->id, true); | |
670 | $submission->status = ASSIGN_SUBMISSION_STATUS_SUBMITTED; | |
671 | $assign->testable_update_submission($submission, $this->students[0]->id, true, false); | |
672 | $this->setUser($this->editingteachers[0]); | |
673 | $this->assertEquals(false, $assign->testable_submissions_open($this->students[0]->id)); | |
674 | } | |
675 | ||
676 | public function test_get_graders() { | |
df211804 | 677 | $this->create_extra_users(); |
47f48152 DW |
678 | $this->setUser($this->editingteachers[0]); |
679 | $assign = $this->create_instance(); | |
680 | ||
a5c793c3 DW |
681 | $this->assertCount(self::DEFAULT_TEACHER_COUNT + |
682 | self::DEFAULT_EDITING_TEACHER_COUNT + | |
683 | self::EXTRA_TEACHER_COUNT + | |
684 | self::EXTRA_EDITING_TEACHER_COUNT, | |
685 | $assign->testable_get_graders($this->students[0]->id)); | |
47f48152 DW |
686 | |
687 | $assign = $this->create_instance(); | |
688 | // Force create an assignment with SEPARATEGROUPS. | |
689 | $generator = $this->getDataGenerator()->get_plugin_generator('mod_assign'); | |
690 | $params = array('course'=>$this->course->id); | |
691 | $instance = $generator->create_instance($params); | |
692 | $cm = get_coursemodule_from_instance('assign', $instance->id); | |
693 | set_coursemodule_groupmode($cm->id, SEPARATEGROUPS); | |
694 | $cm->groupmode = SEPARATEGROUPS; | |
695 | $context = context_module::instance($cm->id); | |
696 | $assign = new testable_assign($context, $cm, $this->course); | |
697 | ||
698 | $this->setUser($this->students[1]); | |
a5c793c3 | 699 | $this->assertCount(4, $assign->testable_get_graders($this->students[0]->id)); |
47f48152 DW |
700 | } |
701 | ||
702 | public function test_get_uniqueid_for_user() { | |
703 | $this->setUser($this->editingteachers[0]); | |
704 | $assign = $this->create_instance(); | |
705 | ||
706 | foreach ($this->students as $student) { | |
707 | $uniqueid = $assign->get_uniqueid_for_user($student->id); | |
708 | $this->assertEquals($student->id, $assign->get_user_id_for_uniqueid($uniqueid)); | |
709 | } | |
710 | } | |
711 | ||
46692c3a | 712 | public function test_show_student_summary() { |
c2114099 | 713 | global $CFG, $PAGE; |
46692c3a DW |
714 | |
715 | $this->setUser($this->editingteachers[0]); | |
716 | $assign = $this->create_instance(); | |
c2114099 | 717 | $PAGE->set_url(new moodle_url('/mod/assign/view.php', array('id' => $assign->get_course_module()->id))); |
46692c3a DW |
718 | |
719 | // No feedback should be available because this student has not been graded. | |
720 | $this->setUser($this->students[0]); | |
721 | $output = $assign->view_student_summary($this->students[0], true); | |
722 | $this->assertEquals(false, strpos($output, 'Feedback'), 'Do not show feedback if there is no grade'); | |
723 | // Simulate adding a grade. | |
724 | $this->setUser($this->teachers[0]); | |
725 | $data = new stdClass(); | |
726 | $data->grade = '50.0'; | |
df211804 | 727 | $assign->testable_apply_grade_to_user($data, $this->students[0]->id, 0); |
46692c3a | 728 | |
b0da618b | 729 | // Now we should see the feedback. |
46692c3a DW |
730 | $this->setUser($this->students[0]); |
731 | $output = $assign->view_student_summary($this->students[0], true); | |
732 | $this->assertNotEquals(false, strpos($output, 'Feedback'), 'Show feedback if there is a grade'); | |
733 | ||
734 | // Now hide the grade in gradebook. | |
735 | $this->setUser($this->teachers[0]); | |
736 | require_once($CFG->libdir.'/gradelib.php'); | |
737 | $gradeitem = new grade_item(array( | |
738 | 'itemtype' => 'mod', | |
739 | 'itemmodule' => 'assign', | |
740 | 'iteminstance' => $assign->get_instance()->id, | |
741 | 'courseid' => $this->course->id)); | |
742 | ||
743 | $gradeitem->set_hidden(1, false); | |
744 | ||
745 | // No feedback should be available because the grade is hidden. | |
746 | $this->setUser($this->students[0]); | |
747 | $output = $assign->view_student_summary($this->students[0], true); | |
748 | $this->assertEquals(false, strpos($output, 'Feedback'), 'Do not show feedback if the grade is hidden in the gradebook'); | |
749 | ||
b0da618b | 750 | // Do the same but add feedback. |
46692c3a DW |
751 | $assign = $this->create_instance(array('assignfeedback_comments_enabled' => 1)); |
752 | ||
753 | $this->setUser($this->teachers[0]); | |
754 | $grade = $assign->get_user_grade($this->students[0]->id, true); | |
755 | $data = new stdClass(); | |
756 | $data->assignfeedbackcomments_editor = array('text'=>'Tomato sauce', | |
757 | 'format'=>FORMAT_MOODLE); | |
758 | $plugin = $assign->get_feedback_plugin_by_type('comments'); | |
759 | $plugin->save($grade, $data); | |
760 | ||
b0da618b | 761 | // Should have feedback but no grade. |
46692c3a DW |
762 | $this->setUser($this->students[0]); |
763 | $output = $assign->view_student_summary($this->students[0], true); | |
ea698284 | 764 | $this->assertNotEquals(false, strpos($output, 'Feedback'), 'Show feedback even if there is no grade'); |
46692c3a DW |
765 | $this->assertEquals(false, strpos($output, 'Grade'), 'Do not show grade when there is no grade.'); |
766 | $this->assertEquals(false, strpos($output, 'Graded on'), 'Do not show graded date when there is no grade.'); | |
45aac51a | 767 | |
ea698284 AD |
768 | // Now hide the grade in gradebook. |
769 | $this->setUser($this->teachers[0]); | |
770 | $gradeitem = new grade_item(array( | |
771 | 'itemtype' => 'mod', | |
772 | 'itemmodule' => 'assign', | |
773 | 'iteminstance' => $assign->get_instance()->id, | |
774 | 'courseid' => $this->course->id)); | |
775 | ||
776 | $gradeitem->set_hidden(1, false); | |
777 | ||
778 | // No feedback should be available because the grade is hidden. | |
779 | $this->setUser($this->students[0]); | |
780 | $output = $assign->view_student_summary($this->students[0], true); | |
781 | $this->assertEquals(false, strpos($output, 'Feedback'), 'Do not show feedback if the grade is hidden in the gradebook'); | |
46692c3a DW |
782 | } |
783 | ||
df211804 DW |
784 | public function test_attempt_reopen_method_manual() { |
785 | global $PAGE; | |
786 | ||
787 | $this->setUser($this->editingteachers[0]); | |
788 | $assign = $this->create_instance(array('attemptreopenmethod'=>ASSIGN_ATTEMPT_REOPEN_METHOD_MANUAL, | |
789 | 'maxattempts'=>3, | |
790 | 'submissiondrafts'=>1, | |
791 | 'assignsubmission_onlinetext_enabled'=>1)); | |
792 | $PAGE->set_url(new moodle_url('/mod/assign/view.php', array('id' => $assign->get_course_module()->id))); | |
793 | ||
794 | // Student should be able to see an add submission button. | |
795 | $this->setUser($this->students[0]); | |
796 | $output = $assign->view_student_summary($this->students[0], true); | |
797 | $this->assertNotEquals(false, strpos($output, get_string('addsubmission', 'assign'))); | |
798 | ||
799 | // Add a submission. | |
800 | $now = time(); | |
801 | $submission = $assign->get_user_submission($this->students[0]->id, true); | |
802 | $data = new stdClass(); | |
803 | $data->onlinetext_editor = array('itemid'=>file_get_unused_draft_itemid(), | |
804 | 'text'=>'Submission text', | |
805 | 'format'=>FORMAT_MOODLE); | |
806 | $plugin = $assign->get_submission_plugin_by_type('onlinetext'); | |
807 | $plugin->save($submission, $data); | |
808 | ||
809 | // And now submit it for marking. | |
810 | $submission->status = ASSIGN_SUBMISSION_STATUS_SUBMITTED; | |
811 | $assign->testable_update_submission($submission, $this->students[0]->id, true, false); | |
812 | ||
813 | // Verify the student cannot make changes to the submission. | |
814 | $output = $assign->view_student_summary($this->students[0], true); | |
815 | $this->assertEquals(false, strpos($output, get_string('addsubmission', 'assign'))); | |
816 | ||
817 | // Mark the submission. | |
818 | $this->setUser($this->teachers[0]); | |
819 | $data = new stdClass(); | |
820 | $data->grade = '50.0'; | |
821 | $assign->testable_apply_grade_to_user($data, $this->students[0]->id, 0); | |
822 | ||
823 | // Check the student can see the grade. | |
824 | $this->setUser($this->students[0]); | |
825 | $output = $assign->view_student_summary($this->students[0], true); | |
826 | $this->assertNotEquals(false, strpos($output, '50.0')); | |
827 | ||
828 | // Allow the student another attempt. | |
829 | $this->teachers[0]->ignoresesskey = true; | |
830 | $this->setUser($this->teachers[0]); | |
831 | $result = $assign->testable_process_add_attempt($this->students[0]->id); | |
832 | $this->assertEquals(true, $result); | |
833 | ||
834 | // Check that the previous attempt is now in the submission history table. | |
835 | $this->setUser($this->students[0]); | |
836 | $output = $assign->view_student_summary($this->students[0], true); | |
837 | // Need a better check. | |
838 | $this->assertNotEquals(false, strpos($output, 'Submission text'), 'Contains: Submission text'); | |
839 | ||
840 | // Check that the student now has a button for Add a new attempt". | |
841 | $this->assertNotEquals(false, strpos($output, get_string('addnewattempt', 'assign'))); | |
842 | // Check that the student now does not have a button for Submit. | |
843 | $this->assertEquals(false, strpos($output, get_string('submitassignment', 'assign'))); | |
844 | ||
845 | // Check that the student now has a submission history. | |
846 | $this->assertNotEquals(false, strpos($output, get_string('attempthistory', 'assign'))); | |
847 | ||
848 | $this->setUser($this->teachers[0]); | |
849 | // Check that the grading table loads correctly and contains this user. | |
850 | // This is also testing that we do not get duplicate rows in the grading table. | |
851 | $gradingtable = new assign_grading_table($assign, 100, '', 0, true); | |
852 | $output = $assign->get_renderer()->render($gradingtable); | |
853 | $this->assertEquals(true, strpos($output, $this->students[0]->lastname)); | |
854 | ||
855 | // Should be 1 not 2. | |
856 | $this->assertEquals(1, $assign->count_submissions()); | |
857 | $this->assertEquals(1, $assign->count_submissions_with_status('reopened')); | |
858 | $this->assertEquals(0, $assign->count_submissions_need_grading()); | |
859 | $this->assertEquals(1, $assign->count_grades()); | |
860 | ||
861 | // Change max attempts to unlimited. | |
862 | $formdata = clone($assign->get_instance()); | |
863 | $formdata->maxattempts = ASSIGN_UNLIMITED_ATTEMPTS; | |
864 | $formdata->instance = $formdata->id; | |
865 | $assign->update_instance($formdata); | |
866 | ||
867 | // Check we can repopen still. | |
868 | $result = $assign->testable_process_add_attempt($this->students[0]->id); | |
869 | $this->assertEquals(true, $result); | |
870 | ||
871 | $grades = $assign->get_user_grades_for_gradebook($this->students[0]->id); | |
872 | $this->assertEquals(50, (int)$grades[$this->students[0]->id]->rawgrade); | |
873 | ||
df211804 | 874 | } |
46692c3a | 875 | |
f8d107b3 DM |
876 | public function test_markingworkflow() { |
877 | global $PAGE; | |
878 | ||
879 | $this->setUser($this->editingteachers[0]); | |
880 | $assign = $this->create_instance(array('markingworkflow'=>1)); | |
881 | $PAGE->set_url(new moodle_url('/mod/assign/view.php', array('id' => $assign->get_course_module()->id))); | |
882 | ||
13e82f1c | 883 | // Mark the submission and set to notmarked. |
f8d107b3 DM |
884 | $this->setUser($this->teachers[0]); |
885 | $data = new stdClass(); | |
886 | $data->grade = '50.0'; | |
887 | $data->workflowstate = ASSIGN_MARKING_WORKFLOW_STATE_NOTMARKED; | |
888 | $assign->testable_apply_grade_to_user($data, $this->students[0]->id, 0); | |
889 | ||
890 | // Check the student can't see the grade. | |
891 | $this->setUser($this->students[0]); | |
892 | $output = $assign->view_student_summary($this->students[0], true); | |
893 | $this->assertEquals(false, strpos($output, '50.0')); | |
894 | ||
13e82f1c | 895 | // Mark the submission and set to inmarking. |
f8d107b3 DM |
896 | $this->setUser($this->teachers[0]); |
897 | $data = new stdClass(); | |
898 | $data->grade = '50.0'; | |
899 | $data->workflowstate = ASSIGN_MARKING_WORKFLOW_STATE_INMARKING; | |
900 | $assign->testable_apply_grade_to_user($data, $this->students[0]->id, 0); | |
901 | ||
902 | // Check the student can't see the grade. | |
903 | $this->setUser($this->students[0]); | |
904 | $output = $assign->view_student_summary($this->students[0], true); | |
905 | $this->assertEquals(false, strpos($output, '50.0')); | |
906 | ||
13e82f1c | 907 | // Mark the submission and set to readyforreview. |
f8d107b3 DM |
908 | $this->setUser($this->teachers[0]); |
909 | $data = new stdClass(); | |
910 | $data->grade = '50.0'; | |
911 | $data->workflowstate = ASSIGN_MARKING_WORKFLOW_STATE_READYFORREVIEW; | |
912 | $assign->testable_apply_grade_to_user($data, $this->students[0]->id, 0); | |
913 | ||
914 | // Check the student can't see the grade. | |
915 | $this->setUser($this->students[0]); | |
916 | $output = $assign->view_student_summary($this->students[0], true); | |
917 | $this->assertEquals(false, strpos($output, '50.0')); | |
918 | ||
13e82f1c | 919 | // Mark the submission and set to inreview. |
f8d107b3 DM |
920 | $this->setUser($this->teachers[0]); |
921 | $data = new stdClass(); | |
922 | $data->grade = '50.0'; | |
923 | $data->workflowstate = ASSIGN_MARKING_WORKFLOW_STATE_INREVIEW; | |
924 | $assign->testable_apply_grade_to_user($data, $this->students[0]->id, 0); | |
925 | ||
926 | // Check the student can't see the grade. | |
927 | $this->setUser($this->students[0]); | |
928 | $output = $assign->view_student_summary($this->students[0], true); | |
929 | $this->assertEquals(false, strpos($output, '50.0')); | |
930 | ||
13e82f1c | 931 | // Mark the submission and set to readyforrelease. |
f8d107b3 DM |
932 | $this->setUser($this->teachers[0]); |
933 | $data = new stdClass(); | |
934 | $data->grade = '50.0'; | |
935 | $data->workflowstate = ASSIGN_MARKING_WORKFLOW_STATE_READYFORRELEASE; | |
936 | $assign->testable_apply_grade_to_user($data, $this->students[0]->id, 0); | |
937 | ||
938 | // Check the student can't see the grade. | |
939 | $this->setUser($this->students[0]); | |
940 | $output = $assign->view_student_summary($this->students[0], true); | |
941 | $this->assertEquals(false, strpos($output, '50.0')); | |
942 | ||
13e82f1c | 943 | // Mark the submission and set to released. |
f8d107b3 DM |
944 | $this->setUser($this->teachers[0]); |
945 | $data = new stdClass(); | |
946 | $data->grade = '50.0'; | |
947 | $data->workflowstate = ASSIGN_MARKING_WORKFLOW_STATE_RELEASED; | |
948 | $assign->testable_apply_grade_to_user($data, $this->students[0]->id, 0); | |
949 | ||
950 | // Check the student can see the grade. | |
951 | $this->setUser($this->students[0]); | |
952 | $output = $assign->view_student_summary($this->students[0], true); | |
953 | $this->assertNotEquals(false, strpos($output, '50.0')); | |
954 | } | |
955 | ||
956 | public function test_markerallocation() { | |
957 | global $PAGE; | |
958 | ||
959 | $this->setUser($this->editingteachers[0]); | |
13e82f1c | 960 | $assign = $this->create_instance(array('markingworkflow'=>1, 'markingallocation'=>1)); |
f8d107b3 DM |
961 | $PAGE->set_url(new moodle_url('/mod/assign/view.php', array('id' => $assign->get_course_module()->id))); |
962 | ||
13e82f1c | 963 | // Allocate marker to submission. |
f8d107b3 DM |
964 | $data = new stdClass(); |
965 | $data->allocatedmarker = $this->teachers[0]->id; | |
966 | $assign->testable_apply_grade_to_user($data, $this->students[0]->id, 0); | |
967 | ||
13e82f1c | 968 | // Check the allocated marker can view the submission. |
f8d107b3 DM |
969 | $this->setUser($this->teachers[0]); |
970 | $gradingtable = new assign_grading_table($assign, 100, '', 0, true); | |
971 | $output = $assign->get_renderer()->render($gradingtable); | |
972 | $this->assertEquals(true, strpos($output, $this->students[0]->lastname)); | |
973 | ||
13e82f1c | 974 | // Check that other teachers can't view this submission. |
f8d107b3 DM |
975 | $this->setUser($this->teachers[1]); |
976 | $gradingtable = new assign_grading_table($assign, 100, '', 0, true); | |
977 | $output = $assign->get_renderer()->render($gradingtable); | |
978 | $this->assertNotEquals(true, strpos($output, $this->students[0]->lastname)); | |
979 | } | |
76e77b05 FM |
980 | |
981 | public function test_extension_granted_event() { | |
982 | $this->setUser($this->editingteachers[0]); | |
983 | ||
984 | $tomorrow = time() + 24*60*60; | |
985 | $yesterday = time() - 24*60*60; | |
986 | ||
987 | $assign = $this->create_instance(array('duedate' => $yesterday, 'cutoffdate' => $yesterday)); | |
988 | $sink = $this->redirectEvents(); | |
989 | ||
990 | $assign->testable_save_user_extension($this->students[0]->id, $tomorrow); | |
991 | ||
992 | $events = $sink->get_events(); | |
993 | $this->assertCount(1, $events); | |
994 | $event = reset($events); | |
995 | $this->assertInstanceOf('\mod_assign\event\extension_granted', $event); | |
996 | $this->assertEquals($assign->get_context(), $event->get_context()); | |
997 | $this->assertEquals($assign->get_instance()->id, $event->objectid); | |
998 | $this->assertEquals($this->students[0]->id, $event->relateduserid); | |
999 | $expected = array( | |
1000 | $assign->get_course()->id, | |
1001 | 'assign', | |
1002 | 'grant extension', | |
1003 | 'view.php?id=' . $assign->get_course_module()->id, | |
1004 | $this->students[0]->id, | |
1005 | $assign->get_course_module()->id, | |
1006 | $this->editingteachers[0]->id | |
1007 | ); | |
1008 | $this->assertEventLegacyLogData($expected, $event); | |
1009 | $sink->close(); | |
1010 | } | |
1011 | ||
3d1331be FM |
1012 | public function test_submission_locked_event() { |
1013 | $this->editingteachers[0]->ignoresesskey = true; | |
1014 | $this->setUser($this->editingteachers[0]); | |
1015 | ||
1016 | $assign = $this->create_instance(); | |
1017 | $sink = $this->redirectEvents(); | |
1018 | ||
1019 | $assign->testable_process_lock($this->students[0]->id); | |
1020 | ||
1021 | $events = $sink->get_events(); | |
1022 | $this->assertCount(1, $events); | |
1023 | $event = reset($events); | |
1024 | $this->assertInstanceOf('\mod_assign\event\submission_locked', $event); | |
1025 | $this->assertEquals($assign->get_context(), $event->get_context()); | |
1026 | $this->assertEquals($assign->get_instance()->id, $event->objectid); | |
1027 | $this->assertEquals($this->students[0]->id, $event->relateduserid); | |
1028 | $expected = array( | |
1029 | $assign->get_course()->id, | |
1030 | 'assign', | |
1031 | 'lock submission', | |
1032 | 'view.php?id=' . $assign->get_course_module()->id, | |
1033 | get_string('locksubmissionforstudent', 'assign', array('id' => $this->students[0]->id, | |
1034 | 'fullname' => fullname($this->students[0]))), | |
1035 | $assign->get_course_module()->id, | |
1036 | $this->editingteachers[0]->id | |
1037 | ); | |
1038 | $this->assertEventLegacyLogData($expected, $event); | |
1039 | $sink->close(); | |
1040 | ||
1041 | // Revert to defaults. | |
1042 | $this->editingteachers[0]->ignoresesskey = false; | |
1043 | } | |
1044 | ||
ad10ad14 FM |
1045 | public function test_identities_revealed_event() { |
1046 | $this->editingteachers[0]->ignoresesskey = true; | |
1047 | $this->setUser($this->editingteachers[0]); | |
1048 | ||
1049 | $assign = $this->create_instance(array('blindmarking'=>1)); | |
1050 | $sink = $this->redirectEvents(); | |
1051 | ||
1052 | $assign->testable_process_reveal_identities(); | |
1053 | ||
1054 | $events = $sink->get_events(); | |
1055 | $this->assertCount(1, $events); | |
1056 | $event = reset($events); | |
1057 | $this->assertInstanceOf('\mod_assign\event\identities_revealed', $event); | |
1058 | $this->assertEquals($assign->get_context(), $event->get_context()); | |
1059 | $this->assertEquals($assign->get_instance()->id, $event->objectid); | |
1060 | $expected = array( | |
1061 | $assign->get_course()->id, | |
1062 | 'assign', | |
1063 | 'reveal identities', | |
1064 | 'view.php?id=' . $assign->get_course_module()->id, | |
1065 | get_string('revealidentities', 'assign'), | |
1066 | $assign->get_course_module()->id, | |
1067 | $this->editingteachers[0]->id | |
1068 | ); | |
1069 | $this->assertEventLegacyLogData($expected, $event); | |
1070 | $sink->close(); | |
1071 | ||
1072 | // Revert to defaults. | |
1073 | $this->editingteachers[0]->ignoresesskey = false; | |
1074 | } | |
1075 | ||
159b7f40 FM |
1076 | public function test_submission_status_updated_event() { |
1077 | $this->editingteachers[0]->ignoresesskey = true; | |
1078 | $this->setUser($this->editingteachers[0]); | |
1079 | ||
1080 | $assign = $this->create_instance(); | |
1081 | $submission = $assign->get_user_submission($this->students[0]->id, true); | |
1082 | $submission->status = ASSIGN_SUBMISSION_STATUS_SUBMITTED; | |
1083 | $assign->testable_update_submission($submission, $this->students[0]->id, true, false); | |
1084 | ||
1085 | $sink = $this->redirectEvents(); | |
1086 | $assign->testable_process_revert_to_draft($this->students[0]->id); | |
1087 | ||
1088 | $events = $sink->get_events(); | |
1089 | $this->assertCount(1, $events); | |
1090 | $event = reset($events); | |
1091 | $this->assertInstanceOf('\mod_assign\event\submission_status_updated', $event); | |
1092 | $this->assertEquals($assign->get_context(), $event->get_context()); | |
1093 | $this->assertEquals($submission->id, $event->objectid); | |
1094 | $this->assertEquals($this->students[0]->id, $event->relateduserid); | |
1095 | $this->assertEquals(ASSIGN_SUBMISSION_STATUS_DRAFT, $event->other['newstatus']); | |
1096 | $expected = array( | |
1097 | $assign->get_course()->id, | |
1098 | 'assign', | |
1099 | 'revert submission to draft', | |
1100 | 'view.php?id=' . $assign->get_course_module()->id, | |
1101 | get_string('reverttodraftforstudent', 'assign', array('id' => $this->students[0]->id, | |
1102 | 'fullname' => fullname($this->students[0]))), | |
1103 | $assign->get_course_module()->id, | |
1104 | $this->editingteachers[0]->id | |
1105 | ); | |
1106 | $this->assertEventLegacyLogData($expected, $event); | |
1107 | $sink->close(); | |
1108 | ||
1109 | // Revert to defaults. | |
1110 | $this->editingteachers[0]->ignoresesskey = false; | |
1111 | } | |
1112 | ||
e59a85ba FM |
1113 | public function test_marker_updated_event() { |
1114 | $this->editingteachers[0]->ignoresesskey = true; | |
1115 | $this->setUser($this->editingteachers[0]); | |
1116 | ||
1117 | $assign = $this->create_instance(); | |
1118 | ||
1119 | $sink = $this->redirectEvents(); | |
1120 | $assign->testable_process_set_batch_marking_allocation($this->students[0]->id, $this->teachers[0]->id); | |
1121 | ||
1122 | $events = $sink->get_events(); | |
1123 | $this->assertCount(1, $events); | |
1124 | $event = reset($events); | |
1125 | $this->assertInstanceOf('\mod_assign\event\marker_updated', $event); | |
1126 | $this->assertEquals($assign->get_context(), $event->get_context()); | |
1127 | $this->assertEquals($assign->get_instance()->id, $event->objectid); | |
1128 | $this->assertEquals($this->students[0]->id, $event->relateduserid); | |
1129 | $this->assertEquals($this->editingteachers[0]->id, $event->userid); | |
1130 | $this->assertEquals($this->teachers[0]->id, $event->other['markerid']); | |
1131 | $expected = array( | |
1132 | $assign->get_course()->id, | |
1133 | 'assign', | |
1134 | 'set marking allocation', | |
1135 | 'view.php?id=' . $assign->get_course_module()->id, | |
1136 | get_string('setmarkerallocationforlog', 'assign', array('id' => $this->students[0]->id, | |
1137 | 'fullname' => fullname($this->students[0]), 'marker' => fullname($this->teachers[0]))), | |
1138 | $assign->get_course_module()->id, | |
1139 | $this->editingteachers[0]->id | |
1140 | ); | |
1141 | $this->assertEventLegacyLogData($expected, $event); | |
1142 | $sink->close(); | |
1143 | ||
1144 | // Revert to defaults. | |
1145 | $this->editingteachers[0]->ignoresesskey = false; | |
1146 | } | |
1147 | ||
8bb213eb FM |
1148 | public function test_workflow_state_updated_event() { |
1149 | $this->editingteachers[0]->ignoresesskey = true; | |
1150 | $this->setUser($this->editingteachers[0]); | |
1151 | ||
1152 | $assign = $this->create_instance(); | |
1153 | ||
1154 | $sink = $this->redirectEvents(); | |
1155 | $assign->testable_process_set_batch_marking_workflow_state($this->students[0]->id, ASSIGN_MARKING_WORKFLOW_STATE_INREVIEW); | |
1156 | ||
1157 | $events = $sink->get_events(); | |
1158 | $this->assertCount(1, $events); | |
1159 | $event = reset($events); | |
1160 | $this->assertInstanceOf('\mod_assign\event\workflow_state_updated', $event); | |
1161 | $this->assertEquals($assign->get_context(), $event->get_context()); | |
1162 | $this->assertEquals($assign->get_instance()->id, $event->objectid); | |
1163 | $this->assertEquals($this->students[0]->id, $event->relateduserid); | |
1164 | $this->assertEquals($this->editingteachers[0]->id, $event->userid); | |
1165 | $this->assertEquals(ASSIGN_MARKING_WORKFLOW_STATE_INREVIEW, $event->other['newstate']); | |
1166 | $expected = array( | |
1167 | $assign->get_course()->id, | |
1168 | 'assign', | |
1169 | 'set marking workflow state', | |
1170 | 'view.php?id=' . $assign->get_course_module()->id, | |
1171 | get_string('setmarkingworkflowstateforlog', 'assign', array('id' => $this->students[0]->id, | |
1172 | 'fullname' => fullname($this->students[0]), 'state' => ASSIGN_MARKING_WORKFLOW_STATE_INREVIEW)), | |
1173 | $assign->get_course_module()->id, | |
1174 | $this->editingteachers[0]->id | |
1175 | ); | |
1176 | $this->assertEventLegacyLogData($expected, $event); | |
1177 | $sink->close(); | |
1178 | ||
1179 | // Revert to defaults. | |
1180 | $this->editingteachers[0]->ignoresesskey = false; | |
1181 | } | |
89fbc202 FM |
1182 | |
1183 | public function test_submission_duplicated_event() { | |
1184 | $this->setUser($this->students[0]); | |
1185 | ||
1186 | $assign = $this->create_instance(); | |
1187 | $submission1 = $assign->get_user_submission($this->students[0]->id, true, 0); | |
1188 | $submission2 = $assign->get_user_submission($this->students[0]->id, true, 1); | |
1189 | $submission2->status = ASSIGN_SUBMISSION_STATUS_REOPENED; | |
1190 | $assign->testable_update_submission($submission2, $this->students[0]->id, time(), $assign->get_instance()->teamsubmission); | |
1191 | ||
1192 | $sink = $this->redirectEvents(); | |
1193 | $notices = null; | |
1194 | $assign->testable_process_copy_previous_attempt($notices); | |
1195 | ||
1196 | $events = $sink->get_events(); | |
1197 | $this->assertCount(1, $events); | |
1198 | $event = reset($events); | |
1199 | $this->assertInstanceOf('\mod_assign\event\submission_duplicated', $event); | |
1200 | $this->assertEquals($assign->get_context(), $event->get_context()); | |
1201 | $this->assertEquals($submission2->id, $event->objectid); | |
1202 | $this->assertEquals($this->students[0]->id, $event->userid); | |
1203 | $submission2->status = ASSIGN_SUBMISSION_STATUS_DRAFT; | |
1204 | $expected = array( | |
1205 | $assign->get_course()->id, | |
1206 | 'assign', | |
1207 | 'submissioncopied', | |
1208 | 'view.php?id=' . $assign->get_course_module()->id, | |
1209 | $assign->testable_format_submission_for_log($submission2), | |
1210 | $assign->get_course_module()->id, | |
1211 | $this->students[0]->id | |
1212 | ); | |
1213 | $this->assertEventLegacyLogData($expected, $event); | |
1214 | $sink->close(); | |
1215 | } | |
1216 | ||
9a289c3d FM |
1217 | public function test_submission_unlocked_event() { |
1218 | $this->editingteachers[0]->ignoresesskey = true; | |
1219 | $this->setUser($this->editingteachers[0]); | |
1220 | ||
1221 | $assign = $this->create_instance(); | |
1222 | $sink = $this->redirectEvents(); | |
1223 | ||
1224 | $assign->testable_process_unlock($this->students[0]->id); | |
1225 | ||
1226 | $events = $sink->get_events(); | |
1227 | $this->assertCount(1, $events); | |
1228 | $event = reset($events); | |
1229 | $this->assertInstanceOf('\mod_assign\event\submission_unlocked', $event); | |
1230 | $this->assertEquals($assign->get_context(), $event->get_context()); | |
1231 | $this->assertEquals($assign->get_instance()->id, $event->objectid); | |
1232 | $this->assertEquals($this->students[0]->id, $event->relateduserid); | |
1233 | $expected = array( | |
1234 | $assign->get_course()->id, | |
1235 | 'assign', | |
1236 | 'unlock submission', | |
1237 | 'view.php?id=' . $assign->get_course_module()->id, | |
1238 | get_string('unlocksubmissionforstudent', 'assign', array('id' => $this->students[0]->id, | |
1239 | 'fullname' => fullname($this->students[0]))), | |
1240 | $assign->get_course_module()->id, | |
1241 | $this->editingteachers[0]->id | |
1242 | ); | |
1243 | $this->assertEventLegacyLogData($expected, $event); | |
1244 | $sink->close(); | |
1245 | ||
1246 | // Revert to defaults. | |
1247 | $this->editingteachers[0]->ignoresesskey = false; | |
1248 | } | |
1249 | ||
bd2e9829 FM |
1250 | public function test_submission_graded_event() { |
1251 | $this->setUser($this->editingteachers[0]); | |
1252 | $assign = $this->create_instance(); | |
1253 | ||
1254 | // Test apply_grade_to_user. | |
1255 | $sink = $this->redirectEvents(); | |
1256 | ||
1257 | $data = new stdClass(); | |
1258 | $data->grade = '50.0'; | |
1259 | $assign->testable_apply_grade_to_user($data, $this->students[0]->id, 0); | |
1260 | $grade = $assign->get_user_grade($this->students[0]->id, false, 0); | |
1261 | ||
1262 | $events = $sink->get_events(); | |
1263 | $this->assertCount(1, $events); | |
1264 | $event = reset($events); | |
1265 | $this->assertInstanceOf('\mod_assign\event\submission_graded', $event); | |
1266 | $this->assertEquals($assign->get_context(), $event->get_context()); | |
1267 | $this->assertEquals($grade->id, $event->objectid); | |
1268 | $this->assertEquals($this->students[0]->id, $event->relateduserid); | |
1269 | $expected = array( | |
1270 | $assign->get_course()->id, | |
1271 | 'assign', | |
1272 | 'grade submission', | |
1273 | 'view.php?id=' . $assign->get_course_module()->id, | |
1274 | $assign->format_grade_for_log($grade), | |
1275 | $assign->get_course_module()->id, | |
1276 | $this->editingteachers[0]->id | |
1277 | ); | |
1278 | $this->assertEventLegacyLogData($expected, $event); | |
1279 | $sink->close(); | |
1280 | ||
1281 | // Test process_save_quick_grades. | |
1282 | $sink = $this->redirectEvents(); | |
1283 | ||
1284 | $data = array( | |
1285 | 'grademodified_' . $this->students[0]->id => time(), | |
1286 | 'quickgrade_' . $this->students[0]->id => '60.0' | |
1287 | ); | |
1288 | $assign->testable_process_save_quick_grades($data); | |
1289 | $grade = $assign->get_user_grade($this->students[0]->id, false); | |
1290 | $this->assertEquals('60.0', $grade->grade); | |
1291 | ||
1292 | $events = $sink->get_events(); | |
1293 | $this->assertCount(1, $events); | |
1294 | $event = reset($events); | |
1295 | $this->assertInstanceOf('\mod_assign\event\submission_graded', $event); | |
1296 | $this->assertEquals($assign->get_context(), $event->get_context()); | |
1297 | $this->assertEquals($grade->id, $event->objectid); | |
1298 | $this->assertEquals($this->students[0]->id, $event->relateduserid); | |
1299 | $expected = array( | |
1300 | $assign->get_course()->id, | |
1301 | 'assign', | |
1302 | 'grade submission', | |
1303 | 'view.php?id=' . $assign->get_course_module()->id, | |
1304 | $assign->format_grade_for_log($grade), | |
1305 | $assign->get_course_module()->id, | |
1306 | $this->editingteachers[0]->id | |
1307 | ); | |
1308 | $this->assertEventLegacyLogData($expected, $event); | |
1309 | $sink->close(); | |
1310 | } | |
1311 | ||
9054c04d | 1312 | public function test_disable_submit_after_cutoff_date() { |
1313 | global $PAGE; | |
1314 | ||
1315 | $this->setUser($this->editingteachers[0]); | |
1316 | $now = time(); | |
1317 | $tomorrow = $now + 24*60*60; | |
1318 | $lastweek = $now - 7*24*60*60; | |
1319 | $yesterday = $now - 24*60*60; | |
1320 | ||
1321 | $assign = $this->create_instance(array('duedate'=>$yesterday, | |
1322 | 'cutoffdate'=>$tomorrow, | |
1323 | 'assignsubmission_onlinetext_enabled'=>1)); | |
1324 | $PAGE->set_url(new moodle_url('/mod/assign/view.php', array('id' => $assign->get_course_module()->id))); | |
1325 | ||
1326 | // Student should be able to see an add submission button. | |
1327 | $this->setUser($this->students[0]); | |
1328 | $output = $assign->view_student_summary($this->students[0], true); | |
1329 | $this->assertNotEquals(false, strpos($output, get_string('addsubmission', 'assign'))); | |
1330 | ||
1331 | // Add a submission but don't submit now. | |
1332 | $submission = $assign->get_user_submission($this->students[0]->id, true); | |
1333 | $data = new stdClass(); | |
1334 | $data->onlinetext_editor = array('itemid'=>file_get_unused_draft_itemid(), | |
1335 | 'text'=>'Submission text', | |
1336 | 'format'=>FORMAT_MOODLE); | |
1337 | $plugin = $assign->get_submission_plugin_by_type('onlinetext'); | |
1338 | $plugin->save($submission, $data); | |
1339 | ||
1340 | // Create another instance with cut-off and due-date already passed. | |
1341 | $this->setUser($this->editingteachers[0]); | |
1342 | $now = time(); | |
1343 | $assign = $this->create_instance(array('duedate'=>$lastweek, | |
1344 | 'cutoffdate'=>$yesterday, | |
1345 | 'assignsubmission_onlinetext_enabled'=>1)); | |
1346 | ||
1347 | $this->setUser($this->students[0]); | |
1348 | $output = $assign->view_student_summary($this->students[0], true); | |
1349 | $this->assertNotContains($output, get_string('editsubmission', 'assign'), | |
1350 | 'Should not be able to edit after cutoff date.'); | |
1351 | $this->assertNotContains($output, get_string('submitassignment', 'assign'), | |
1352 | 'Should not be able to submit after cutoff date.'); | |
1353 | } | |
47f48152 DW |
1354 | } |
1355 |