| Línea 47... |
Línea 47... |
| 47 |
use mod_assign_test_generator;
|
47 |
use mod_assign_test_generator;
|
| Línea 48... |
Línea 48... |
| 48 |
|
48 |
|
| 49 |
/**
|
49 |
/**
|
| 50 |
* Test that assign_print_recent_activity shows ungraded submitted assignments.
|
50 |
* Test that assign_print_recent_activity shows ungraded submitted assignments.
|
| 51 |
*/
|
51 |
*/
|
| 52 |
public function test_print_recent_activity() {
|
52 |
public function test_print_recent_activity(): void {
|
| 53 |
$this->resetAfterTest();
|
53 |
$this->resetAfterTest();
|
| 54 |
$course = $this->getDataGenerator()->create_course();
|
54 |
$course = $this->getDataGenerator()->create_course();
|
| 55 |
$teacher = $this->getDataGenerator()->create_and_enrol($course, 'teacher');
|
55 |
$teacher = $this->getDataGenerator()->create_and_enrol($course, 'teacher');
|
| 56 |
$student = $this->getDataGenerator()->create_and_enrol($course, 'student');
|
56 |
$student = $this->getDataGenerator()->create_and_enrol($course, 'student');
|
| Línea 63... |
Línea 63... |
| 63 |
}
|
63 |
}
|
| Línea 64... |
Línea 64... |
| 64 |
|
64 |
|
| 65 |
/**
|
65 |
/**
|
| 66 |
* Test that assign_print_recent_activity does not display any warnings when a custom fullname has been configured.
|
66 |
* Test that assign_print_recent_activity does not display any warnings when a custom fullname has been configured.
|
| 67 |
*/
|
67 |
*/
|
| 68 |
public function test_print_recent_activity_fullname() {
|
68 |
public function test_print_recent_activity_fullname(): void {
|
| 69 |
$this->resetAfterTest();
|
69 |
$this->resetAfterTest();
|
| 70 |
$course = $this->getDataGenerator()->create_course();
|
70 |
$course = $this->getDataGenerator()->create_course();
|
| 71 |
$teacher = $this->getDataGenerator()->create_and_enrol($course, 'teacher');
|
71 |
$teacher = $this->getDataGenerator()->create_and_enrol($course, 'teacher');
|
| 72 |
$student = $this->getDataGenerator()->create_and_enrol($course, 'student');
|
72 |
$student = $this->getDataGenerator()->create_and_enrol($course, 'student');
|
| Línea 80... |
Línea 80... |
| 80 |
}
|
80 |
}
|
| Línea 81... |
Línea 81... |
| 81 |
|
81 |
|
| 82 |
/**
|
82 |
/**
|
| 83 |
* Test that assign_print_recent_activity shows the blind marking ID.
|
83 |
* Test that assign_print_recent_activity shows the blind marking ID.
|
| 84 |
*/
|
84 |
*/
|
| 85 |
public function test_print_recent_activity_fullname_blind_marking() {
|
85 |
public function test_print_recent_activity_fullname_blind_marking(): void {
|
| 86 |
$this->resetAfterTest();
|
86 |
$this->resetAfterTest();
|
| 87 |
$course = $this->getDataGenerator()->create_course();
|
87 |
$course = $this->getDataGenerator()->create_course();
|
| 88 |
$teacher = $this->getDataGenerator()->create_and_enrol($course, 'teacher');
|
88 |
$teacher = $this->getDataGenerator()->create_and_enrol($course, 'teacher');
|
| Línea 102... |
Línea 102... |
| 102 |
}
|
102 |
}
|
| Línea 103... |
Línea 103... |
| 103 |
|
103 |
|
| 104 |
/**
|
104 |
/**
|
| 105 |
* Test that assign_get_recent_mod_activity fetches the assignment correctly.
|
105 |
* Test that assign_get_recent_mod_activity fetches the assignment correctly.
|
| 106 |
*/
|
106 |
*/
|
| 107 |
public function test_assign_get_recent_mod_activity() {
|
107 |
public function test_assign_get_recent_mod_activity(): void {
|
| 108 |
$this->resetAfterTest();
|
108 |
$this->resetAfterTest();
|
| 109 |
$course = $this->getDataGenerator()->create_course();
|
109 |
$course = $this->getDataGenerator()->create_course();
|
| 110 |
$teacher = $this->getDataGenerator()->create_and_enrol($course, 'teacher');
|
110 |
$teacher = $this->getDataGenerator()->create_and_enrol($course, 'teacher');
|
| 111 |
$student = $this->getDataGenerator()->create_and_enrol($course, 'student');
|
111 |
$student = $this->getDataGenerator()->create_and_enrol($course, 'student');
|
| Línea 130... |
Línea 130... |
| 130 |
}
|
130 |
}
|
| Línea 131... |
Línea 131... |
| 131 |
|
131 |
|
| 132 |
/**
|
132 |
/**
|
| 133 |
* Ensure that assign_user_complete displays information about drafts.
|
133 |
* Ensure that assign_user_complete displays information about drafts.
|
| 134 |
*/
|
134 |
*/
|
| 135 |
public function test_assign_user_complete() {
|
135 |
public function test_assign_user_complete(): void {
|
| Línea 136... |
Línea 136... |
| 136 |
global $PAGE, $DB;
|
136 |
global $PAGE, $DB;
|
| 137 |
|
137 |
|
| 138 |
$this->resetAfterTest();
|
138 |
$this->resetAfterTest();
|
| Línea 153... |
Línea 153... |
| 153 |
}
|
153 |
}
|
| Línea 154... |
Línea 154... |
| 154 |
|
154 |
|
| 155 |
/**
|
155 |
/**
|
| 156 |
* Ensure that assign_user_outline fetches updated grades.
|
156 |
* Ensure that assign_user_outline fetches updated grades.
|
| 157 |
*/
|
157 |
*/
|
| 158 |
public function test_assign_user_outline() {
|
158 |
public function test_assign_user_outline(): void {
|
| 159 |
$this->resetAfterTest();
|
159 |
$this->resetAfterTest();
|
| 160 |
$course = $this->getDataGenerator()->create_course();
|
160 |
$course = $this->getDataGenerator()->create_course();
|
| 161 |
$teacher = $this->getDataGenerator()->create_and_enrol($course, 'teacher');
|
161 |
$teacher = $this->getDataGenerator()->create_and_enrol($course, 'teacher');
|
| 162 |
$student = $this->getDataGenerator()->create_and_enrol($course, 'student');
|
162 |
$student = $this->getDataGenerator()->create_and_enrol($course, 'student');
|
| Línea 177... |
Línea 177... |
| 177 |
}
|
177 |
}
|
| Línea 178... |
Línea 178... |
| 178 |
|
178 |
|
| 179 |
/**
|
179 |
/**
|
| 180 |
* Tests for mod_assign_refresh_events.
|
180 |
* Tests for mod_assign_refresh_events.
|
| 181 |
*/
|
181 |
*/
|
| 182 |
public function test_assign_refresh_events() {
|
182 |
public function test_assign_refresh_events(): void {
|
| Línea 183... |
Línea 183... |
| 183 |
global $DB;
|
183 |
global $DB;
|
| Línea 184... |
Línea 184... |
| 184 |
|
184 |
|
| Línea 262... |
Línea 262... |
| 262 |
|
262 |
|
| 263 |
// Invalid course ID.
|
263 |
// Invalid course ID.
|
| 264 |
$this->assertFalse(assign_refresh_events('aaa'));
|
264 |
$this->assertFalse(assign_refresh_events('aaa'));
|
| Línea 265... |
Línea 265... |
| 265 |
}
|
265 |
}
|
| 266 |
|
266 |
|
| 267 |
public function test_assign_core_calendar_is_event_visible_duedate_event_as_teacher() {
|
267 |
public function test_assign_core_calendar_is_event_visible_duedate_event_as_teacher(): void {
|
| 268 |
$this->resetAfterTest();
|
268 |
$this->resetAfterTest();
|
| 269 |
$course = $this->getDataGenerator()->create_course();
|
269 |
$course = $this->getDataGenerator()->create_course();
|
| Línea 278... |
Línea 278... |
| 278 |
// The teacher should see the due date event.
|
278 |
// The teacher should see the due date event.
|
| 279 |
$this->setUser($teacher);
|
279 |
$this->setUser($teacher);
|
| 280 |
$this->assertTrue(mod_assign_core_calendar_is_event_visible($event));
|
280 |
$this->assertTrue(mod_assign_core_calendar_is_event_visible($event));
|
| 281 |
}
|
281 |
}
|
| Línea 282... |
Línea 282... |
| 282 |
|
282 |
|
| 283 |
public function test_assign_core_calendar_is_event_visible_duedate_event_for_teacher() {
|
283 |
public function test_assign_core_calendar_is_event_visible_duedate_event_for_teacher(): void {
|
| 284 |
$this->resetAfterTest();
|
284 |
$this->resetAfterTest();
|
| 285 |
$course = $this->getDataGenerator()->create_course();
|
285 |
$course = $this->getDataGenerator()->create_course();
|
| 286 |
$teacher = $this->getDataGenerator()->create_and_enrol($course, 'teacher');
|
286 |
$teacher = $this->getDataGenerator()->create_and_enrol($course, 'teacher');
|
| Línea 296... |
Línea 296... |
| 296 |
|
296 |
|
| 297 |
// The teacher should see the due date event.
|
297 |
// The teacher should see the due date event.
|
| 298 |
$this->assertTrue(mod_assign_core_calendar_is_event_visible($event, $teacher->id));
|
298 |
$this->assertTrue(mod_assign_core_calendar_is_event_visible($event, $teacher->id));
|
| Línea 299... |
Línea 299... |
| 299 |
}
|
299 |
}
|
| 300 |
|
300 |
|
| 301 |
public function test_assign_core_calendar_is_event_visible_duedate_event_as_student() {
|
301 |
public function test_assign_core_calendar_is_event_visible_duedate_event_as_student(): void {
|
| 302 |
$this->resetAfterTest();
|
302 |
$this->resetAfterTest();
|
| 303 |
$course = $this->getDataGenerator()->create_course();
|
303 |
$course = $this->getDataGenerator()->create_course();
|
| 304 |
$teacher = $this->getDataGenerator()->create_and_enrol($course, 'teacher');
|
304 |
$teacher = $this->getDataGenerator()->create_and_enrol($course, 'teacher');
|
| Línea 313... |
Línea 313... |
| 313 |
// The student should care about the due date event.
|
313 |
// The student should care about the due date event.
|
| 314 |
$this->setUser($student);
|
314 |
$this->setUser($student);
|
| 315 |
$this->assertTrue(mod_assign_core_calendar_is_event_visible($event));
|
315 |
$this->assertTrue(mod_assign_core_calendar_is_event_visible($event));
|
| 316 |
}
|
316 |
}
|
| Línea 317... |
Línea 317... |
| 317 |
|
317 |
|
| 318 |
public function test_assign_core_calendar_is_event_visible_duedate_event_for_student() {
|
318 |
public function test_assign_core_calendar_is_event_visible_duedate_event_for_student(): void {
|
| 319 |
$this->resetAfterTest();
|
319 |
$this->resetAfterTest();
|
| 320 |
$course = $this->getDataGenerator()->create_course();
|
320 |
$course = $this->getDataGenerator()->create_course();
|
| 321 |
$teacher = $this->getDataGenerator()->create_and_enrol($course, 'teacher');
|
321 |
$teacher = $this->getDataGenerator()->create_and_enrol($course, 'teacher');
|
| 322 |
$student = $this->getDataGenerator()->create_and_enrol($course, 'student');
|
322 |
$student = $this->getDataGenerator()->create_and_enrol($course, 'student');
|
| Línea 332... |
Línea 332... |
| 332 |
|
332 |
|
| 333 |
// The student should care about the due date event.
|
333 |
// The student should care about the due date event.
|
| 334 |
$this->assertTrue(mod_assign_core_calendar_is_event_visible($event, $student->id));
|
334 |
$this->assertTrue(mod_assign_core_calendar_is_event_visible($event, $student->id));
|
| Línea 335... |
Línea 335... |
| 335 |
}
|
335 |
}
|
| 336 |
|
336 |
|
| 337 |
public function test_assign_core_calendar_is_event_visible_gradingduedate_event_as_teacher() {
|
337 |
public function test_assign_core_calendar_is_event_visible_gradingduedate_event_as_teacher(): void {
|
| 338 |
$this->resetAfterTest();
|
338 |
$this->resetAfterTest();
|
| 339 |
$course = $this->getDataGenerator()->create_course();
|
339 |
$course = $this->getDataGenerator()->create_course();
|
| Línea 348... |
Línea 348... |
| 348 |
$this->setUser($teacher);
|
348 |
$this->setUser($teacher);
|
| 349 |
$this->assertTrue(mod_assign_core_calendar_is_event_visible($event));
|
349 |
$this->assertTrue(mod_assign_core_calendar_is_event_visible($event));
|
| 350 |
}
|
350 |
}
|
| Línea 351... |
Línea 351... |
| 351 |
|
351 |
|
| 352 |
|
352 |
|
| 353 |
public function test_assign_core_calendar_is_event_visible_gradingduedate_event_for_teacher() {
|
353 |
public function test_assign_core_calendar_is_event_visible_gradingduedate_event_for_teacher(): void {
|
| 354 |
$this->resetAfterTest();
|
354 |
$this->resetAfterTest();
|
| 355 |
$course = $this->getDataGenerator()->create_course();
|
355 |
$course = $this->getDataGenerator()->create_course();
|
| Línea 365... |
Línea 365... |
| 365 |
|
365 |
|
| 366 |
// The teacher should see the due date event.
|
366 |
// The teacher should see the due date event.
|
| 367 |
$this->assertTrue(mod_assign_core_calendar_is_event_visible($event, $teacher->id));
|
367 |
$this->assertTrue(mod_assign_core_calendar_is_event_visible($event, $teacher->id));
|
| Línea 368... |
Línea 368... |
| 368 |
}
|
368 |
}
|
| 369 |
|
369 |
|
| 370 |
public function test_assign_core_calendar_is_event_visible_gradingduedate_event_as_student() {
|
370 |
public function test_assign_core_calendar_is_event_visible_gradingduedate_event_as_student(): void {
|
| 371 |
$this->resetAfterTest();
|
371 |
$this->resetAfterTest();
|
| 372 |
$course = $this->getDataGenerator()->create_course();
|
372 |
$course = $this->getDataGenerator()->create_course();
|
| Línea 381... |
Línea 381... |
| 381 |
$this->setUser($student);
|
381 |
$this->setUser($student);
|
| 382 |
$this->assertFalse(mod_assign_core_calendar_is_event_visible($event));
|
382 |
$this->assertFalse(mod_assign_core_calendar_is_event_visible($event));
|
| 383 |
}
|
383 |
}
|
| Línea 384... |
Línea 384... |
| 384 |
|
384 |
|
| 385 |
|
385 |
|
| 386 |
public function test_assign_core_calendar_is_event_visible_gradingduedate_event_for_student() {
|
386 |
public function test_assign_core_calendar_is_event_visible_gradingduedate_event_for_student(): void {
|
| 387 |
$this->resetAfterTest();
|
387 |
$this->resetAfterTest();
|
| 388 |
$course = $this->getDataGenerator()->create_course();
|
388 |
$course = $this->getDataGenerator()->create_course();
|
| Línea 398... |
Línea 398... |
| 398 |
|
398 |
|
| 399 |
// The student should not see the due date event.
|
399 |
// The student should not see the due date event.
|
| 400 |
$this->assertFalse(mod_assign_core_calendar_is_event_visible($event, $student->id));
|
400 |
$this->assertFalse(mod_assign_core_calendar_is_event_visible($event, $student->id));
|
| Línea 401... |
Línea 401... |
| 401 |
}
|
401 |
}
|
| 402 |
|
402 |
|
| 403 |
public function test_assign_core_calendar_provide_event_action_duedate_as_teacher() {
|
403 |
public function test_assign_core_calendar_provide_event_action_duedate_as_teacher(): void {
|
| 404 |
$this->resetAfterTest();
|
404 |
$this->resetAfterTest();
|
| 405 |
$course = $this->getDataGenerator()->create_course();
|
405 |
$course = $this->getDataGenerator()->create_course();
|
| Línea 417... |
Línea 417... |
| 417 |
|
417 |
|
| 418 |
// The teacher should not have an action for a due date event.
|
418 |
// The teacher should not have an action for a due date event.
|
| 419 |
$this->assertNull($actionevent);
|
419 |
$this->assertNull($actionevent);
|
| Línea 420... |
Línea 420... |
| 420 |
}
|
420 |
}
|
| 421 |
|
421 |
|
| 422 |
public function test_assign_core_calendar_provide_event_action_duedate_for_teacher() {
|
422 |
public function test_assign_core_calendar_provide_event_action_duedate_for_teacher(): void {
|
| 423 |
$this->resetAfterTest();
|
423 |
$this->resetAfterTest();
|
| 424 |
$course = $this->getDataGenerator()->create_course();
|
424 |
$course = $this->getDataGenerator()->create_course();
|
| Línea 438... |
Línea 438... |
| 438 |
|
438 |
|
| 439 |
// The teacher should not have an action for a due date event.
|
439 |
// The teacher should not have an action for a due date event.
|
| 440 |
$this->assertNull($actionevent);
|
440 |
$this->assertNull($actionevent);
|
| Línea 441... |
Línea 441... |
| 441 |
}
|
441 |
}
|
| 442 |
|
442 |
|
| 443 |
public function test_assign_core_calendar_provide_event_action_duedate_as_student() {
|
443 |
public function test_assign_core_calendar_provide_event_action_duedate_as_student(): void {
|
| 444 |
$this->resetAfterTest();
|
444 |
$this->resetAfterTest();
|
| 445 |
$course = $this->getDataGenerator()->create_course();
|
445 |
$course = $this->getDataGenerator()->create_course();
|
| Línea 461... |
Línea 461... |
| 461 |
$this->assertInstanceOf('moodle_url', $actionevent->get_url());
|
461 |
$this->assertInstanceOf('moodle_url', $actionevent->get_url());
|
| 462 |
$this->assertEquals(1, $actionevent->get_item_count());
|
462 |
$this->assertEquals(1, $actionevent->get_item_count());
|
| 463 |
$this->assertTrue($actionevent->is_actionable());
|
463 |
$this->assertTrue($actionevent->is_actionable());
|
| 464 |
}
|
464 |
}
|
| Línea 465... |
Línea 465... |
| 465 |
|
465 |
|
| 466 |
public function test_assign_core_calendar_provide_event_action_duedate_for_student() {
|
466 |
public function test_assign_core_calendar_provide_event_action_duedate_for_student(): void {
|
| 467 |
$this->resetAfterTest();
|
467 |
$this->resetAfterTest();
|
| 468 |
$course = $this->getDataGenerator()->create_course();
|
468 |
$course = $this->getDataGenerator()->create_course();
|
| 469 |
$student = $this->getDataGenerator()->create_and_enrol($course, 'student');
|
469 |
$student = $this->getDataGenerator()->create_and_enrol($course, 'student');
|
| Línea 549... |
Línea 549... |
| 549 |
|
549 |
|
| 550 |
$actionevent2 = mod_assign_core_calendar_provide_event_action($event, $factory, $student2->id);
|
550 |
$actionevent2 = mod_assign_core_calendar_provide_event_action($event, $factory, $student2->id);
|
| 551 |
$this->assertNull($actionevent2);
|
551 |
$this->assertNull($actionevent2);
|
| Línea 552... |
Línea 552... |
| 552 |
}
|
552 |
}
|
| 553 |
|
553 |
|
| 554 |
public function test_assign_core_calendar_provide_event_action_gradingduedate_as_teacher() {
|
554 |
public function test_assign_core_calendar_provide_event_action_gradingduedate_as_teacher(): void {
|
| 555 |
$this->resetAfterTest();
|
555 |
$this->resetAfterTest();
|
| 556 |
$course = $this->getDataGenerator()->create_course();
|
556 |
$course = $this->getDataGenerator()->create_course();
|
| Línea 571... |
Línea 571... |
| 571 |
$this->assertInstanceOf('moodle_url', $actionevent->get_url());
|
571 |
$this->assertInstanceOf('moodle_url', $actionevent->get_url());
|
| 572 |
$this->assertEquals(0, $actionevent->get_item_count());
|
572 |
$this->assertEquals(0, $actionevent->get_item_count());
|
| 573 |
$this->assertTrue($actionevent->is_actionable());
|
573 |
$this->assertTrue($actionevent->is_actionable());
|
| 574 |
}
|
574 |
}
|
| Línea 575... |
Línea 575... |
| 575 |
|
575 |
|
| 576 |
public function test_assign_core_calendar_provide_event_action_gradingduedate_for_teacher() {
|
576 |
public function test_assign_core_calendar_provide_event_action_gradingduedate_for_teacher(): void {
|
| 577 |
$this->resetAfterTest();
|
577 |
$this->resetAfterTest();
|
| 578 |
$course = $this->getDataGenerator()->create_course();
|
578 |
$course = $this->getDataGenerator()->create_course();
|
| 579 |
$teacher = $this->getDataGenerator()->create_and_enrol($course, 'teacher');
|
579 |
$teacher = $this->getDataGenerator()->create_and_enrol($course, 'teacher');
|
| Línea 596... |
Línea 596... |
| 596 |
$this->assertInstanceOf('moodle_url', $actionevent->get_url());
|
596 |
$this->assertInstanceOf('moodle_url', $actionevent->get_url());
|
| 597 |
$this->assertEquals(0, $actionevent->get_item_count());
|
597 |
$this->assertEquals(0, $actionevent->get_item_count());
|
| 598 |
$this->assertTrue($actionevent->is_actionable());
|
598 |
$this->assertTrue($actionevent->is_actionable());
|
| 599 |
}
|
599 |
}
|
| Línea 600... |
Línea 600... |
| 600 |
|
600 |
|
| 601 |
public function test_assign_core_calendar_provide_event_action_gradingduedate_as_student() {
|
601 |
public function test_assign_core_calendar_provide_event_action_gradingduedate_as_student(): void {
|
| 602 |
$this->resetAfterTest();
|
602 |
$this->resetAfterTest();
|
| 603 |
$course = $this->getDataGenerator()->create_course();
|
603 |
$course = $this->getDataGenerator()->create_course();
|
| 604 |
$student = $this->getDataGenerator()->create_and_enrol($course, 'student');
|
604 |
$student = $this->getDataGenerator()->create_and_enrol($course, 'student');
|
| Línea 618... |
Línea 618... |
| 618 |
$this->assertInstanceOf('moodle_url', $actionevent->get_url());
|
618 |
$this->assertInstanceOf('moodle_url', $actionevent->get_url());
|
| 619 |
$this->assertEquals(0, $actionevent->get_item_count());
|
619 |
$this->assertEquals(0, $actionevent->get_item_count());
|
| 620 |
$this->assertFalse($actionevent->is_actionable());
|
620 |
$this->assertFalse($actionevent->is_actionable());
|
| 621 |
}
|
621 |
}
|
| Línea 622... |
Línea 622... |
| 622 |
|
622 |
|
| 623 |
public function test_assign_core_calendar_provide_event_action_gradingduedate_for_student() {
|
623 |
public function test_assign_core_calendar_provide_event_action_gradingduedate_for_student(): void {
|
| 624 |
$this->resetAfterTest();
|
624 |
$this->resetAfterTest();
|
| 625 |
$course = $this->getDataGenerator()->create_course();
|
625 |
$course = $this->getDataGenerator()->create_course();
|
| 626 |
$student = $this->getDataGenerator()->create_and_enrol($course, 'student');
|
626 |
$student = $this->getDataGenerator()->create_and_enrol($course, 'student');
|
| Línea 643... |
Línea 643... |
| 643 |
$this->assertInstanceOf('moodle_url', $actionevent->get_url());
|
643 |
$this->assertInstanceOf('moodle_url', $actionevent->get_url());
|
| 644 |
$this->assertEquals(0, $actionevent->get_item_count());
|
644 |
$this->assertEquals(0, $actionevent->get_item_count());
|
| 645 |
$this->assertFalse($actionevent->is_actionable());
|
645 |
$this->assertFalse($actionevent->is_actionable());
|
| 646 |
}
|
646 |
}
|
| Línea 647... |
Línea 647... |
| 647 |
|
647 |
|
| 648 |
public function test_assign_core_calendar_provide_event_action_duedate_as_student_submitted() {
|
648 |
public function test_assign_core_calendar_provide_event_action_duedate_as_student_submitted(): void {
|
| 649 |
$this->resetAfterTest();
|
649 |
$this->resetAfterTest();
|
| 650 |
$course = $this->getDataGenerator()->create_course();
|
650 |
$course = $this->getDataGenerator()->create_course();
|
| 651 |
$teacher = $this->getDataGenerator()->create_and_enrol($course, 'teacher');
|
651 |
$teacher = $this->getDataGenerator()->create_and_enrol($course, 'teacher');
|
| 652 |
$student = $this->getDataGenerator()->create_and_enrol($course, 'student');
|
652 |
$student = $this->getDataGenerator()->create_and_enrol($course, 'student');
|
| Línea 668... |
Línea 668... |
| 668 |
$factory = new \core_calendar\action_factory();
|
668 |
$factory = new \core_calendar\action_factory();
|
| 669 |
$actionevent = mod_assign_core_calendar_provide_event_action($event, $factory);
|
669 |
$actionevent = mod_assign_core_calendar_provide_event_action($event, $factory);
|
| 670 |
$this->assertNull($actionevent);
|
670 |
$this->assertNull($actionevent);
|
| 671 |
}
|
671 |
}
|
| Línea 672... |
Línea 672... |
| 672 |
|
672 |
|
| 673 |
public function test_assign_core_calendar_provide_event_action_duedate_for_student_submitted() {
|
673 |
public function test_assign_core_calendar_provide_event_action_duedate_for_student_submitted(): void {
|
| 674 |
$this->resetAfterTest();
|
674 |
$this->resetAfterTest();
|
| 675 |
$course = $this->getDataGenerator()->create_course();
|
675 |
$course = $this->getDataGenerator()->create_course();
|
| 676 |
$teacher = $this->getDataGenerator()->create_and_enrol($course, 'teacher');
|
676 |
$teacher = $this->getDataGenerator()->create_and_enrol($course, 'teacher');
|
| 677 |
$student = $this->getDataGenerator()->create_and_enrol($course, 'student');
|
677 |
$student = $this->getDataGenerator()->create_and_enrol($course, 'student');
|
| Línea 696... |
Línea 696... |
| 696 |
$factory = new \core_calendar\action_factory();
|
696 |
$factory = new \core_calendar\action_factory();
|
| 697 |
$actionevent = mod_assign_core_calendar_provide_event_action($event, $factory, $student->id);
|
697 |
$actionevent = mod_assign_core_calendar_provide_event_action($event, $factory, $student->id);
|
| 698 |
$this->assertNull($actionevent);
|
698 |
$this->assertNull($actionevent);
|
| 699 |
}
|
699 |
}
|
| Línea 700... |
Línea 700... |
| 700 |
|
700 |
|
| 701 |
public function test_assign_core_calendar_provide_event_action_already_completed() {
|
701 |
public function test_assign_core_calendar_provide_event_action_already_completed(): void {
|
| 702 |
$this->resetAfterTest();
|
702 |
$this->resetAfterTest();
|
| 703 |
set_config('enablecompletion', 1);
|
703 |
set_config('enablecompletion', 1);
|
| Línea 704... |
Línea 704... |
| 704 |
$this->setAdminUser();
|
704 |
$this->setAdminUser();
|
| Línea 727... |
Línea 727... |
| 727 |
|
727 |
|
| 728 |
// Ensure result was null.
|
728 |
// Ensure result was null.
|
| 729 |
$this->assertNull($actionevent);
|
729 |
$this->assertNull($actionevent);
|
| Línea 730... |
Línea 730... |
| 730 |
}
|
730 |
}
|
| 731 |
|
731 |
|
| 732 |
public function test_assign_core_calendar_provide_event_action_already_completed_for_user() {
|
732 |
public function test_assign_core_calendar_provide_event_action_already_completed_for_user(): void {
|
| 733 |
$this->resetAfterTest();
|
733 |
$this->resetAfterTest();
|
| Línea 734... |
Línea 734... |
| 734 |
set_config('enablecompletion', 1);
|
734 |
set_config('enablecompletion', 1);
|
| Línea 787... |
Línea 787... |
| 787 |
/**
|
787 |
/**
|
| 788 |
* Test the callback responsible for returning the completion rule descriptions.
|
788 |
* Test the callback responsible for returning the completion rule descriptions.
|
| 789 |
* This function should work given either an instance of the module (cm_info), such as when checking the active rules,
|
789 |
* This function should work given either an instance of the module (cm_info), such as when checking the active rules,
|
| 790 |
* or if passed a stdClass of similar structure, such as when checking the the default completion settings for a mod type.
|
790 |
* or if passed a stdClass of similar structure, such as when checking the the default completion settings for a mod type.
|
| 791 |
*/
|
791 |
*/
|
| 792 |
public function test_mod_assign_completion_get_active_rule_descriptions() {
|
792 |
public function test_mod_assign_completion_get_active_rule_descriptions(): void {
|
| 793 |
$this->resetAfterTest();
|
793 |
$this->resetAfterTest();
|
| 794 |
$course = $this->getDataGenerator()->create_course(['enablecompletion' => 1]);
|
794 |
$course = $this->getDataGenerator()->create_course(['enablecompletion' => 1]);
|
| Línea 795... |
Línea 795... |
| 795 |
|
795 |
|
| Línea 819... |
Línea 819... |
| 819 |
}
|
819 |
}
|
| Línea 820... |
Línea 820... |
| 820 |
|
820 |
|
| 821 |
/**
|
821 |
/**
|
| 822 |
* Test that if some grades are not set, they are left alone and not rescaled
|
822 |
* Test that if some grades are not set, they are left alone and not rescaled
|
| 823 |
*/
|
823 |
*/
|
| 824 |
public function test_assign_rescale_activity_grades_some_unset() {
|
824 |
public function test_assign_rescale_activity_grades_some_unset(): void {
|
| 825 |
$this->resetAfterTest();
|
825 |
$this->resetAfterTest();
|
| 826 |
$course = $this->getDataGenerator()->create_course();
|
826 |
$course = $this->getDataGenerator()->create_course();
|
| 827 |
$teacher = $this->getDataGenerator()->create_and_enrol($course, 'teacher');
|
827 |
$teacher = $this->getDataGenerator()->create_and_enrol($course, 'teacher');
|
| 828 |
$student = $this->getDataGenerator()->create_and_enrol($course, 'student');
|
828 |
$student = $this->getDataGenerator()->create_and_enrol($course, 'student');
|
| Línea 852... |
Línea 852... |
| 852 |
}
|
852 |
}
|
| Línea 853... |
Línea 853... |
| 853 |
|
853 |
|
| 854 |
/**
|
854 |
/**
|
| 855 |
* Return false when there are not overrides for this assign instance.
|
855 |
* Return false when there are not overrides for this assign instance.
|
| 856 |
*/
|
856 |
*/
|
| 857 |
public function test_assign_is_override_calendar_event_no_override() {
|
857 |
public function test_assign_is_override_calendar_event_no_override(): void {
|
| 858 |
global $CFG, $DB;
|
858 |
global $CFG, $DB;
|
| Línea 859... |
Línea 859... |
| 859 |
require_once($CFG->dirroot . '/calendar/lib.php');
|
859 |
require_once($CFG->dirroot . '/calendar/lib.php');
|
| 860 |
|
860 |
|
| Línea 878... |
Línea 878... |
| 878 |
}
|
878 |
}
|
| Línea 879... |
Línea 879... |
| 879 |
|
879 |
|
| 880 |
/**
|
880 |
/**
|
| 881 |
* Return false if the given event isn't an assign module event.
|
881 |
* Return false if the given event isn't an assign module event.
|
| 882 |
*/
|
882 |
*/
|
| 883 |
public function test_assign_is_override_calendar_event_no_nodule_event() {
|
883 |
public function test_assign_is_override_calendar_event_no_nodule_event(): void {
|
| 884 |
global $CFG, $DB;
|
884 |
global $CFG, $DB;
|
| Línea 885... |
Línea 885... |
| 885 |
require_once($CFG->dirroot . '/calendar/lib.php');
|
885 |
require_once($CFG->dirroot . '/calendar/lib.php');
|
| 886 |
|
886 |
|
| Línea 904... |
Línea 904... |
| 904 |
|
904 |
|
| 905 |
/**
|
905 |
/**
|
| 906 |
* Return false if there is overrides for this use but they belong to another assign
|
906 |
* Return false if there is overrides for this use but they belong to another assign
|
| 907 |
* instance.
|
907 |
* instance.
|
| 908 |
*/
|
908 |
*/
|
| 909 |
public function test_assign_is_override_calendar_event_different_assign_instance() {
|
909 |
public function test_assign_is_override_calendar_event_different_assign_instance(): void {
|
| 910 |
global $CFG, $DB;
|
910 |
global $CFG, $DB;
|
| Línea 911... |
Línea 911... |
| 911 |
require_once($CFG->dirroot . '/calendar/lib.php');
|
911 |
require_once($CFG->dirroot . '/calendar/lib.php');
|
| 912 |
|
912 |
|
| Línea 938... |
Línea 938... |
| 938 |
}
|
938 |
}
|
| Línea 939... |
Línea 939... |
| 939 |
|
939 |
|
| 940 |
/**
|
940 |
/**
|
| 941 |
* Return true if there is a user override for this event and assign instance.
|
941 |
* Return true if there is a user override for this event and assign instance.
|
| 942 |
*/
|
942 |
*/
|
| 943 |
public function test_assign_is_override_calendar_event_user_override() {
|
943 |
public function test_assign_is_override_calendar_event_user_override(): void {
|
| 944 |
global $CFG, $DB;
|
944 |
global $CFG, $DB;
|
| Línea 945... |
Línea 945... |
| 945 |
require_once($CFG->dirroot . '/calendar/lib.php');
|
945 |
require_once($CFG->dirroot . '/calendar/lib.php');
|
| 946 |
|
946 |
|
| Línea 970... |
Línea 970... |
| 970 |
}
|
970 |
}
|
| Línea 971... |
Línea 971... |
| 971 |
|
971 |
|
| 972 |
/**
|
972 |
/**
|
| 973 |
* Return true if there is a group override for the event and assign instance.
|
973 |
* Return true if there is a group override for the event and assign instance.
|
| 974 |
*/
|
974 |
*/
|
| 975 |
public function test_assign_is_override_calendar_event_group_override() {
|
975 |
public function test_assign_is_override_calendar_event_group_override(): void {
|
| 976 |
global $CFG, $DB;
|
976 |
global $CFG, $DB;
|
| Línea 977... |
Línea 977... |
| 977 |
require_once($CFG->dirroot . '/calendar/lib.php');
|
977 |
require_once($CFG->dirroot . '/calendar/lib.php');
|
| 978 |
|
978 |
|
| Línea 1001... |
Línea 1001... |
| 1001 |
}
|
1001 |
}
|
| Línea 1002... |
Línea 1002... |
| 1002 |
|
1002 |
|
| 1003 |
/**
|
1003 |
/**
|
| 1004 |
* Unknown event types should not have any limit restrictions returned.
|
1004 |
* Unknown event types should not have any limit restrictions returned.
|
| 1005 |
*/
|
1005 |
*/
|
| 1006 |
public function test_mod_assign_core_calendar_get_valid_event_timestart_range_unkown_event_type() {
|
1006 |
public function test_mod_assign_core_calendar_get_valid_event_timestart_range_unkown_event_type(): void {
|
| 1007 |
global $CFG;
|
1007 |
global $CFG;
|
| Línea 1008... |
Línea 1008... |
| 1008 |
require_once($CFG->dirroot . '/calendar/lib.php');
|
1008 |
require_once($CFG->dirroot . '/calendar/lib.php');
|
| 1009 |
|
1009 |
|
| Línea 1029... |
Línea 1029... |
| 1029 |
}
|
1029 |
}
|
| Línea 1030... |
Línea 1030... |
| 1030 |
|
1030 |
|
| 1031 |
/**
|
1031 |
/**
|
| 1032 |
* Override events should not have any limit restrictions returned.
|
1032 |
* Override events should not have any limit restrictions returned.
|
| 1033 |
*/
|
1033 |
*/
|
| 1034 |
public function test_mod_assign_core_calendar_get_valid_event_timestart_range_override_event() {
|
1034 |
public function test_mod_assign_core_calendar_get_valid_event_timestart_range_override_event(): void {
|
| 1035 |
global $CFG, $DB;
|
1035 |
global $CFG, $DB;
|
| Línea 1036... |
Línea 1036... |
| 1036 |
require_once($CFG->dirroot . '/calendar/lib.php');
|
1036 |
require_once($CFG->dirroot . '/calendar/lib.php');
|
| 1037 |
|
1037 |
|
| Línea 1067... |
Línea 1067... |
| 1067 |
|
1067 |
|
| 1068 |
/**
|
1068 |
/**
|
| 1069 |
* Assignments configured without a submissions from and cutoff date should not have
|
1069 |
* Assignments configured without a submissions from and cutoff date should not have
|
| 1070 |
* any limits applied.
|
1070 |
* any limits applied.
|
| 1071 |
*/
|
1071 |
*/
|
| 1072 |
public function test_mod_assign_core_calendar_get_valid_event_timestart_range_due_no_limit() {
|
1072 |
public function test_mod_assign_core_calendar_get_valid_event_timestart_range_due_no_limit(): void {
|
| 1073 |
global $CFG, $DB;
|
1073 |
global $CFG, $DB;
|
| Línea 1074... |
Línea 1074... |
| 1074 |
require_once($CFG->dirroot . '/calendar/lib.php');
|
1074 |
require_once($CFG->dirroot . '/calendar/lib.php');
|
| 1075 |
|
1075 |
|
| Línea 1100... |
Línea 1100... |
| 1100 |
|
1100 |
|
| 1101 |
/**
|
1101 |
/**
|
| 1102 |
* Assignments should be bottom and top bound by the submissions from date and cutoff date
|
1102 |
* Assignments should be bottom and top bound by the submissions from date and cutoff date
|
| 1103 |
* respectively.
|
1103 |
* respectively.
|
| 1104 |
*/
|
1104 |
*/
|
| 1105 |
public function test_mod_assign_core_calendar_get_valid_event_timestart_range_due_with_limits() {
|
1105 |
public function test_mod_assign_core_calendar_get_valid_event_timestart_range_due_with_limits(): void {
|
| 1106 |
global $CFG, $DB;
|
1106 |
global $CFG, $DB;
|
| Línea 1107... |
Línea 1107... |
| 1107 |
require_once($CFG->dirroot . '/calendar/lib.php');
|
1107 |
require_once($CFG->dirroot . '/calendar/lib.php');
|
| 1108 |
|
1108 |
|
| Línea 1136... |
Línea 1136... |
| 1136 |
}
|
1136 |
}
|
| Línea 1137... |
Línea 1137... |
| 1137 |
|
1137 |
|
| 1138 |
/**
|
1138 |
/**
|
| 1139 |
* Assignment grading due date should not have any limits of no due date and cutoff date is set.
|
1139 |
* Assignment grading due date should not have any limits of no due date and cutoff date is set.
|
| 1140 |
*/
|
1140 |
*/
|
| 1141 |
public function test_mod_assign_core_calendar_get_valid_event_timestart_range_gradingdue_no_limit() {
|
1141 |
public function test_mod_assign_core_calendar_get_valid_event_timestart_range_gradingdue_no_limit(): void {
|
| 1142 |
global $CFG, $DB;
|
1142 |
global $CFG, $DB;
|
| Línea 1143... |
Línea 1143... |
| 1143 |
require_once($CFG->dirroot . '/calendar/lib.php');
|
1143 |
require_once($CFG->dirroot . '/calendar/lib.php');
|
| 1144 |
|
1144 |
|
| Línea 1167... |
Línea 1167... |
| 1167 |
}
|
1167 |
}
|
| Línea 1168... |
Línea 1168... |
| 1168 |
|
1168 |
|
| 1169 |
/**
|
1169 |
/**
|
| 1170 |
* Assignment grading due event is minimum bound by the due date, if it is set.
|
1170 |
* Assignment grading due event is minimum bound by the due date, if it is set.
|
| 1171 |
*/
|
1171 |
*/
|
| 1172 |
public function test_mod_assign_core_calendar_get_valid_event_timestart_range_gradingdue_with_due_date() {
|
1172 |
public function test_mod_assign_core_calendar_get_valid_event_timestart_range_gradingdue_with_due_date(): void {
|
| 1173 |
global $CFG, $DB;
|
1173 |
global $CFG, $DB;
|
| Línea 1174... |
Línea 1174... |
| 1174 |
require_once($CFG->dirroot . '/calendar/lib.php');
|
1174 |
require_once($CFG->dirroot . '/calendar/lib.php');
|
| 1175 |
|
1175 |
|
| Línea 1196... |
Línea 1196... |
| 1196 |
}
|
1196 |
}
|
| Línea 1197... |
Línea 1197... |
| 1197 |
|
1197 |
|
| 1198 |
/**
|
1198 |
/**
|
| 1199 |
* Non due date events should not update the assignment due date.
|
1199 |
* Non due date events should not update the assignment due date.
|
| 1200 |
*/
|
1200 |
*/
|
| 1201 |
public function test_mod_assign_core_calendar_event_timestart_updated_non_due_event() {
|
1201 |
public function test_mod_assign_core_calendar_event_timestart_updated_non_due_event(): void {
|
| 1202 |
global $CFG, $DB;
|
1202 |
global $CFG, $DB;
|
| Línea 1203... |
Línea 1203... |
| 1203 |
require_once($CFG->dirroot . '/calendar/lib.php');
|
1203 |
require_once($CFG->dirroot . '/calendar/lib.php');
|
| 1204 |
|
1204 |
|
| Línea 1233... |
Línea 1233... |
| 1233 |
}
|
1233 |
}
|
| Línea 1234... |
Línea 1234... |
| 1234 |
|
1234 |
|
| 1235 |
/**
|
1235 |
/**
|
| 1236 |
* Due date override events should not change the assignment due date.
|
1236 |
* Due date override events should not change the assignment due date.
|
| 1237 |
*/
|
1237 |
*/
|
| 1238 |
public function test_mod_assign_core_calendar_event_timestart_updated_due_event_override() {
|
1238 |
public function test_mod_assign_core_calendar_event_timestart_updated_due_event_override(): void {
|
| 1239 |
global $CFG, $DB;
|
1239 |
global $CFG, $DB;
|
| Línea 1240... |
Línea 1240... |
| 1240 |
require_once($CFG->dirroot . '/calendar/lib.php');
|
1240 |
require_once($CFG->dirroot . '/calendar/lib.php');
|
| 1241 |
|
1241 |
|
| Línea 1279... |
Línea 1279... |
| 1279 |
}
|
1279 |
}
|
| Línea 1280... |
Línea 1280... |
| 1280 |
|
1280 |
|
| 1281 |
/**
|
1281 |
/**
|
| 1282 |
* Due date events should update the assignment due date.
|
1282 |
* Due date events should update the assignment due date.
|
| 1283 |
*/
|
1283 |
*/
|
| 1284 |
public function test_mod_assign_core_calendar_event_timestart_updated_due_event() {
|
1284 |
public function test_mod_assign_core_calendar_event_timestart_updated_due_event(): void {
|
| 1285 |
global $CFG, $DB;
|
1285 |
global $CFG, $DB;
|
| Línea 1286... |
Línea 1286... |
| 1286 |
require_once($CFG->dirroot . '/calendar/lib.php');
|
1286 |
require_once($CFG->dirroot . '/calendar/lib.php');
|
| 1287 |
|
1287 |
|
| Línea 1319... |
Línea 1319... |
| 1319 |
/**
|
1319 |
/**
|
| 1320 |
* If a student somehow finds a way to update the due date calendar event
|
1320 |
* If a student somehow finds a way to update the due date calendar event
|
| 1321 |
* then the callback should not be executed to update the assignment due
|
1321 |
* then the callback should not be executed to update the assignment due
|
| 1322 |
* date as well otherwise that would be a security issue.
|
1322 |
* date as well otherwise that would be a security issue.
|
| 1323 |
*/
|
1323 |
*/
|
| 1324 |
public function test_student_role_cant_update_due_event() {
|
1324 |
public function test_student_role_cant_update_due_event(): void {
|
| 1325 |
global $CFG, $DB;
|
1325 |
global $CFG, $DB;
|
| 1326 |
require_once($CFG->dirroot . '/calendar/lib.php');
|
1326 |
require_once($CFG->dirroot . '/calendar/lib.php');
|
| Línea 1327... |
Línea 1327... |
| 1327 |
|
1327 |
|
| 1328 |
$this->resetAfterTest();
|
1328 |
$this->resetAfterTest();
|
| Línea 1375... |
Línea 1375... |
| 1375 |
/**
|
1375 |
/**
|
| 1376 |
* A teacher with the capability to modify an assignment module should be
|
1376 |
* A teacher with the capability to modify an assignment module should be
|
| 1377 |
* able to update the assignment due date by changing the due date calendar
|
1377 |
* able to update the assignment due date by changing the due date calendar
|
| 1378 |
* event.
|
1378 |
* event.
|
| 1379 |
*/
|
1379 |
*/
|
| 1380 |
public function test_teacher_role_can_update_due_event() {
|
1380 |
public function test_teacher_role_can_update_due_event(): void {
|
| 1381 |
global $CFG, $DB;
|
1381 |
global $CFG, $DB;
|
| 1382 |
require_once($CFG->dirroot . '/calendar/lib.php');
|
1382 |
require_once($CFG->dirroot . '/calendar/lib.php');
|
| Línea 1383... |
Línea 1383... |
| 1383 |
|
1383 |
|
| 1384 |
$this->resetAfterTest();
|
1384 |
$this->resetAfterTest();
|
| Línea 1437... |
Línea 1437... |
| 1437 |
}
|
1437 |
}
|
| Línea 1438... |
Línea 1438... |
| 1438 |
|
1438 |
|
| 1439 |
/**
|
1439 |
/**
|
| 1440 |
* A user who does not have capabilities to add events to the calendar should be able to create an assignment.
|
1440 |
* A user who does not have capabilities to add events to the calendar should be able to create an assignment.
|
| 1441 |
*/
|
1441 |
*/
|
| 1442 |
public function test_creation_with_no_calendar_capabilities() {
|
1442 |
public function test_creation_with_no_calendar_capabilities(): void {
|
| 1443 |
$this->resetAfterTest();
|
1443 |
$this->resetAfterTest();
|
| 1444 |
$course = self::getDataGenerator()->create_course();
|
1444 |
$course = self::getDataGenerator()->create_course();
|
| 1445 |
$context = \context_course::instance($course->id);
|
1445 |
$context = \context_course::instance($course->id);
|
| 1446 |
$user = self::getDataGenerator()->create_and_enrol($course, 'editingteacher');
|
1446 |
$user = self::getDataGenerator()->create_and_enrol($course, 'editingteacher');
|