Proyectos de Subversion Moodle

Rev

Rev 1 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 1 Rev 11
Línea 132... Línea 132...
132
    }
132
    }
Línea 133... Línea 133...
133
 
133
 
134
    /**
134
    /**
135
     * Test test_mod_workshop_get_workshops_by_courses
135
     * Test test_mod_workshop_get_workshops_by_courses
136
     */
136
     */
Línea 137... Línea 137...
137
    public function test_mod_workshop_get_workshops_by_courses() {
137
    public function test_mod_workshop_get_workshops_by_courses(): void {
138
 
138
 
Línea 139... Línea 139...
139
        // Create additional course.
139
        // Create additional course.
Línea 232... Línea 232...
232
    }
232
    }
Línea 233... Línea 233...
233
 
233
 
234
    /**
234
    /**
235
     * Test mod_workshop_get_workshop_access_information for students.
235
     * Test mod_workshop_get_workshop_access_information for students.
236
     */
236
     */
Línea 237... Línea 237...
237
    public function test_mod_workshop_get_workshop_access_information_student() {
237
    public function test_mod_workshop_get_workshop_access_information_student(): void {
238
 
238
 
239
        self::setUser($this->student);
239
        self::setUser($this->student);
240
        $result = mod_workshop_external::get_workshop_access_information($this->workshop->id);
240
        $result = mod_workshop_external::get_workshop_access_information($this->workshop->id);
Línea 308... Línea 308...
308
    }
308
    }
Línea 309... Línea 309...
309
 
309
 
310
    /**
310
    /**
311
     * Test mod_workshop_get_workshop_access_information for teachers.
311
     * Test mod_workshop_get_workshop_access_information for teachers.
312
     */
312
     */
Línea 313... Línea 313...
313
    public function test_mod_workshop_get_workshop_access_information_teacher() {
313
    public function test_mod_workshop_get_workshop_access_information_teacher(): void {
314
 
314
 
315
        self::setUser($this->teacher);
315
        self::setUser($this->teacher);
316
        $result = mod_workshop_external::get_workshop_access_information($this->workshop->id);
316
        $result = mod_workshop_external::get_workshop_access_information($this->workshop->id);
Línea 337... Línea 337...
337
    }
337
    }
Línea 338... Línea 338...
338
 
338
 
339
    /**
339
    /**
340
     * Test mod_workshop_get_user_plan for students.
340
     * Test mod_workshop_get_user_plan for students.
341
     */
341
     */
Línea 342... Línea 342...
342
    public function test_mod_workshop_get_user_plan_student() {
342
    public function test_mod_workshop_get_user_plan_student(): void {
343
 
343
 
344
        self::setUser($this->student);
344
        self::setUser($this->student);
Línea 362... Línea 362...
362
    }
362
    }
Línea 363... Línea 363...
363
 
363
 
364
    /**
364
    /**
365
     * Test mod_workshop_get_user_plan for teachers.
365
     * Test mod_workshop_get_user_plan for teachers.
366
     */
366
     */
Línea 367... Línea 367...
367
    public function test_mod_workshop_get_user_plan_teacher() {
367
    public function test_mod_workshop_get_user_plan_teacher(): void {
368
 
368
 
369
        self::setUser($this->teacher);
369
        self::setUser($this->teacher);
Línea 407... Línea 407...
407
    }
407
    }
Línea 408... Línea 408...
408
 
408
 
409
    /**
409
    /**
410
     * Test test_view_workshop invalid id.
410
     * Test test_view_workshop invalid id.
411
     */
411
     */
412
    public function test_view_workshop_invalid_id() {
412
    public function test_view_workshop_invalid_id(): void {
413
        $this->expectException('moodle_exception');
413
        $this->expectException('moodle_exception');
414
        mod_workshop_external::view_workshop(0);
414
        mod_workshop_external::view_workshop(0);
Línea 415... Línea 415...
415
    }
415
    }
416
 
416
 
417
    /**
417
    /**
418
     * Test test_view_workshop user not enrolled.
418
     * Test test_view_workshop user not enrolled.
419
     */
419
     */
420
    public function test_view_workshop_user_not_enrolled() {
420
    public function test_view_workshop_user_not_enrolled(): void {
421
        // Test not-enrolled user.
421
        // Test not-enrolled user.
422
        $usernotenrolled = self::getDataGenerator()->create_user();
422
        $usernotenrolled = self::getDataGenerator()->create_user();
423
        $this->setUser($usernotenrolled);
423
        $this->setUser($usernotenrolled);
424
        $this->expectException('moodle_exception');
424
        $this->expectException('moodle_exception');
Línea 425... Línea 425...
425
        mod_workshop_external::view_workshop($this->workshop->id);
425
        mod_workshop_external::view_workshop($this->workshop->id);
426
    }
426
    }
427
 
427
 
428
    /**
428
    /**
429
     * Test test_view_workshop user student.
429
     * Test test_view_workshop user student.
430
     */
430
     */
Línea 431... Línea 431...
431
    public function test_view_workshop_user_student() {
431
    public function test_view_workshop_user_student(): void {
432
        // Test user with full capabilities.
432
        // Test user with full capabilities.
Línea 453... Línea 453...
453
    }
453
    }
Línea 454... Línea 454...
454
 
454
 
455
    /**
455
    /**
456
     * Test test_view_workshop user missing capabilities.
456
     * Test test_view_workshop user missing capabilities.
457
     */
457
     */
458
    public function test_view_workshop_user_missing_capabilities() {
458
    public function test_view_workshop_user_missing_capabilities(): void {
459
        // Test user with no capabilities.
459
        // Test user with no capabilities.
460
        // We need a explicit prohibit since this capability is only defined in authenticated user and guest roles.
460
        // We need a explicit prohibit since this capability is only defined in authenticated user and guest roles.
461
        assign_capability('mod/workshop:view', CAP_PROHIBIT, $this->studentrole->id, $this->context->id);
461
        assign_capability('mod/workshop:view', CAP_PROHIBIT, $this->studentrole->id, $this->context->id);
462
        // Empty all the caches that may be affected  by this change.
462
        // Empty all the caches that may be affected  by this change.
Línea 469... Línea 469...
469
    }
469
    }
Línea 470... Línea 470...
470
 
470
 
471
    /**
471
    /**
472
     * Test test_add_submission.
472
     * Test test_add_submission.
473
     */
473
     */
474
    public function test_add_submission() {
474
    public function test_add_submission(): void {
Línea 475... Línea 475...
475
        $fs = get_file_storage();
475
        $fs = get_file_storage();
476
 
476
 
Línea 540... Línea 540...
540
    }
540
    }
Línea 541... Línea 541...
541
 
541
 
542
    /**
542
    /**
543
     * Test test_add_submission invalid phase.
543
     * Test test_add_submission invalid phase.
544
     */
544
     */
545
    public function test_add_submission_invalid_phase() {
545
    public function test_add_submission_invalid_phase(): void {
Línea 546... Línea 546...
546
        $this->setUser($this->student);
546
        $this->setUser($this->student);
547
 
547
 
548
        $this->expectException('moodle_exception');
548
        $this->expectException('moodle_exception');
Línea 549... Línea 549...
549
        mod_workshop_external::add_submission($this->workshop->id, 'Test');
549
        mod_workshop_external::add_submission($this->workshop->id, 'Test');
550
    }
550
    }
551
 
551
 
552
    /**
552
    /**
553
     * Test test_add_submission empty title.
553
     * Test test_add_submission empty title.
Línea 554... Línea 554...
554
     */
554
     */
555
    public function test_add_submission_empty_title() {
555
    public function test_add_submission_empty_title(): void {
556
        $this->setUser($this->student);
556
        $this->setUser($this->student);
Línea 564... Línea 564...
564
    }
564
    }
Línea 565... Línea 565...
565
 
565
 
566
    /**
566
    /**
567
     * Test test_add_submission already added.
567
     * Test test_add_submission already added.
568
     */
568
     */
569
    public function test_add_submission_already_added() {
569
    public function test_add_submission_already_added(): void {
Línea 570... Línea 570...
570
        $this->setUser($this->student);
570
        $this->setUser($this->student);
571
 
571
 
572
        $usercontext = \context_user::instance($this->student->id);
572
        $usercontext = \context_user::instance($this->student->id);
Línea 646... Línea 646...
646
    }
646
    }
Línea 647... Línea 647...
647
 
647
 
648
    /**
648
    /**
649
     * Test test_update_submission.
649
     * Test test_update_submission.
650
     */
650
     */
Línea 651... Línea 651...
651
    public function test_update_submission() {
651
    public function test_update_submission(): void {
652
 
652
 
Línea 653... Línea 653...
653
        // Create the submission that will be updated.
653
        // Create the submission that will be updated.
Línea 716... Línea 716...
716
    }
716
    }
Línea 717... Línea 717...
717
 
717
 
718
    /**
718
    /**
719
     * Test test_update_submission belonging to other user.
719
     * Test test_update_submission belonging to other user.
720
     */
720
     */
721
    public function test_update_submission_of_other_user() {
721
    public function test_update_submission_of_other_user(): void {
722
        // Create the submission that will be updated.
722
        // Create the submission that will be updated.
Línea 723... Línea 723...
723
        $submissionid = $this->create_test_submission($this->student);
723
        $submissionid = $this->create_test_submission($this->student);
Línea 729... Línea 729...
729
    }
729
    }
Línea 730... Línea 730...
730
 
730
 
731
    /**
731
    /**
732
     * Test test_update_submission invalid phase.
732
     * Test test_update_submission invalid phase.
733
     */
733
     */
734
    public function test_update_submission_invalid_phase() {
734
    public function test_update_submission_invalid_phase(): void {
735
        // Create the submission that will be updated.
735
        // Create the submission that will be updated.
Línea 736... Línea 736...
736
        $submissionid = $this->create_test_submission($this->student);
736
        $submissionid = $this->create_test_submission($this->student);
Línea 746... Línea 746...
746
    }
746
    }
Línea 747... Línea 747...
747
 
747
 
748
    /**
748
    /**
749
     * Test test_update_submission empty title.
749
     * Test test_update_submission empty title.
750
     */
750
     */
751
    public function test_update_submission_empty_title() {
751
    public function test_update_submission_empty_title(): void {
752
        // Create the submission that will be updated.
752
        // Create the submission that will be updated.
Línea 753... Línea 753...
753
        $submissionid = $this->create_test_submission($this->student);
753
        $submissionid = $this->create_test_submission($this->student);
Línea 759... Línea 759...
759
    }
759
    }
Línea 760... Línea 760...
760
 
760
 
761
    /**
761
    /**
762
     * Test test_delete_submission.
762
     * Test test_delete_submission.
763
     */
763
     */
Línea 764... Línea 764...
764
    public function test_delete_submission() {
764
    public function test_delete_submission(): void {
765
 
765
 
Línea 766... Línea 766...
766
        // Create the submission that will be deleted.
766
        // Create the submission that will be deleted.
Línea 789... Línea 789...
789
    }
789
    }
Línea 790... Línea 790...
790
 
790
 
791
    /**
791
    /**
792
     * Test test_delete_submission_with_assessments.
792
     * Test test_delete_submission_with_assessments.
793
     */
793
     */
Línea 794... Línea 794...
794
    public function test_delete_submission_with_assessments() {
794
    public function test_delete_submission_with_assessments(): void {
795
 
795
 
Línea 796... Línea 796...
796
        // Create the submission that will be deleted.
796
        // Create the submission that will be deleted.
Línea 808... Línea 808...
808
    }
808
    }
Línea 809... Línea 809...
809
 
809
 
810
    /**
810
    /**
811
     * Test test_delete_submission_invalid_phase.
811
     * Test test_delete_submission_invalid_phase.
812
     */
812
     */
Línea 813... Línea 813...
813
    public function test_delete_submission_invalid_phase() {
813
    public function test_delete_submission_invalid_phase(): void {
814
 
814
 
Línea 815... Línea 815...
815
        // Create the submission that will be deleted.
815
        // Create the submission that will be deleted.
Línea 825... Línea 825...
825
    }
825
    }
Línea 826... Línea 826...
826
 
826
 
827
    /**
827
    /**
828
     * Test test_delete_submission_as_teacher.
828
     * Test test_delete_submission_as_teacher.
829
     */
829
     */
Línea 830... Línea 830...
830
    public function test_delete_submission_as_teacher() {
830
    public function test_delete_submission_as_teacher(): void {
831
 
831
 
Línea 832... Línea 832...
832
        // Create the submission that will be deleted.
832
        // Create the submission that will be deleted.
Línea 840... Línea 840...
840
    }
840
    }
Línea 841... Línea 841...
841
 
841
 
842
    /**
842
    /**
843
     * Test test_delete_submission_other_user.
843
     * Test test_delete_submission_other_user.
844
     */
844
     */
Línea 845... Línea 845...
845
    public function test_delete_submission_other_user() {
845
    public function test_delete_submission_other_user(): void {
846
 
846
 
847
        $anotheruser = self::getDataGenerator()->create_user();
847
        $anotheruser = self::getDataGenerator()->create_user();
848
        $this->getDataGenerator()->enrol_user($anotheruser->id, $this->course->id, $this->studentrole->id, 'manual');
848
        $this->getDataGenerator()->enrol_user($anotheruser->id, $this->course->id, $this->studentrole->id, 'manual');
Línea 855... Línea 855...
855
    }
855
    }
Línea 856... Línea 856...
856
 
856
 
857
    /**
857
    /**
858
     * Test test_get_submissions_student.
858
     * Test test_get_submissions_student.
859
     */
859
     */
Línea 860... Línea 860...
860
    public function test_get_submissions_student() {
860
    public function test_get_submissions_student(): void {
861
 
861
 
862
        // Create a couple of submissions with files.
862
        // Create a couple of submissions with files.
Línea 885... Línea 885...
885
    }
885
    }
Línea 886... Línea 886...
886
 
886
 
887
    /**
887
    /**
888
     * Test test_get_submissions_published_student.
888
     * Test test_get_submissions_published_student.
889
     */
889
     */
Línea 890... Línea 890...
890
    public function test_get_submissions_published_student() {
890
    public function test_get_submissions_published_student(): void {
891
 
891
 
892
        $workshop = new workshop($this->workshop, $this->cm, $this->course);
892
        $workshop = new workshop($this->workshop, $this->cm, $this->course);
893
        $workshop->switch_phase(workshop::PHASE_CLOSED);
893
        $workshop->switch_phase(workshop::PHASE_CLOSED);
Línea 913... Línea 913...
913
    }
913
    }
Línea 914... Línea 914...
914
 
914
 
915
    /**
915
    /**
916
     * Test test_get_submissions_from_student_with_feedback_from_teacher.
916
     * Test test_get_submissions_from_student_with_feedback_from_teacher.
917
     */
917
     */
918
    public function test_get_submissions_from_student_with_feedback_from_teacher() {
918
    public function test_get_submissions_from_student_with_feedback_from_teacher(): void {
Línea 919... Línea 919...
919
        global $DB;
919
        global $DB;
920
 
920
 
921
        // Create a couple of submissions with files.
921
        // Create a couple of submissions with files.
Línea 946... Línea 946...
946
    }
946
    }
Línea 947... Línea 947...
947
 
947
 
948
    /**
948
    /**
949
     * Test test_get_submissions_from_students_as_teacher.
949
     * Test test_get_submissions_from_students_as_teacher.
950
     */
950
     */
Línea 951... Línea 951...
951
    public function test_get_submissions_from_students_as_teacher() {
951
    public function test_get_submissions_from_students_as_teacher(): void {
952
 
952
 
953
        // Create a couple of submissions with files.
953
        // Create a couple of submissions with files.
954
        $workshopgenerator = $this->getDataGenerator()->get_plugin_generator('mod_workshop');
954
        $workshopgenerator = $this->getDataGenerator()->get_plugin_generator('mod_workshop');
Línea 980... Línea 980...
980
    }
980
    }
Línea 981... Línea 981...
981
 
981
 
982
    /**
982
    /**
983
     * Test test_get_submission_student.
983
     * Test test_get_submission_student.
984
     */
984
     */
Línea 985... Línea 985...
985
    public function test_get_submission_student() {
985
    public function test_get_submission_student(): void {
986
 
986
 
Línea 987... Línea 987...
987
        // Create a couple of submissions with files.
987
        // Create a couple of submissions with files.
Línea 1016... Línea 1016...
1016
    }
1016
    }
Línea 1017... Línea 1017...
1017
 
1017
 
1018
    /**
1018
    /**
1019
     * Test test_get_submission_i_reviewed.
1019
     * Test test_get_submission_i_reviewed.
1020
     */
1020
     */
Línea 1021... Línea 1021...
1021
    public function test_get_submission_i_reviewed() {
1021
    public function test_get_submission_i_reviewed(): void {
1022
 
1022
 
1023
        // Create a couple of submissions with files.
1023
        // Create a couple of submissions with files.
1024
        $firstsubmissionid = $this->create_test_submission($this->student);  // Create submission with files.
1024
        $firstsubmissionid = $this->create_test_submission($this->student);  // Create submission with files.
Línea 1042... Línea 1042...
1042
    }
1042
    }
Línea 1043... Línea 1043...
1043
 
1043
 
1044
    /**
1044
    /**
1045
     * Test test_get_submission_other_student.
1045
     * Test test_get_submission_other_student.
1046
     */
1046
     */
Línea 1047... Línea 1047...
1047
    public function test_get_submission_other_student() {
1047
    public function test_get_submission_other_student(): void {
1048
 
1048
 
1049
        // Create a couple of submissions with files.
1049
        // Create a couple of submissions with files.
1050
        $firstsubmissionid = $this->create_test_submission($this->student);  // Create submission with files.
1050
        $firstsubmissionid = $this->create_test_submission($this->student);  // Create submission with files.
Línea 1055... Línea 1055...
1055
    }
1055
    }
Línea 1056... Línea 1056...
1056
 
1056
 
1057
    /**
1057
    /**
1058
     * Test test_get_submission_published_student.
1058
     * Test test_get_submission_published_student.
1059
     */
1059
     */
Línea 1060... Línea 1060...
1060
    public function test_get_submission_published_student() {
1060
    public function test_get_submission_published_student(): void {
1061
 
1061
 
1062
        $workshop = new workshop($this->workshop, $this->cm, $this->course);
1062
        $workshop = new workshop($this->workshop, $this->cm, $this->course);
1063
        $workshop->switch_phase(workshop::PHASE_CLOSED);
1063
        $workshop->switch_phase(workshop::PHASE_CLOSED);
Línea 1086... Línea 1086...
1086
    }
1086
    }
Línea 1087... Línea 1087...
1087
 
1087
 
1088
    /**
1088
    /**
1089
     * Test test_get_submission_from_student_with_feedback_from_teacher.
1089
     * Test test_get_submission_from_student_with_feedback_from_teacher.
1090
     */
1090
     */
1091
    public function test_get_submission_from_student_with_feedback_from_teacher() {
1091
    public function test_get_submission_from_student_with_feedback_from_teacher(): void {
Línea 1092... Línea 1092...
1092
        global $DB;
1092
        global $DB;
1093
 
1093
 
1094
        // Create a couple of submissions with files.
1094
        // Create a couple of submissions with files.
Línea 1137... Línea 1137...
1137
    }
1137
    }
Línea 1138... Línea 1138...
1138
 
1138
 
1139
    /**
1139
    /**
1140
     * Test test_get_submission_from_students_as_teacher.
1140
     * Test test_get_submission_from_students_as_teacher.
1141
     */
1141
     */
1142
    public function test_get_submission_from_students_as_teacher() {
1142
    public function test_get_submission_from_students_as_teacher(): void {
1143
        // Create a couple of submissions with files.
1143
        // Create a couple of submissions with files.
1144
        $workshopgenerator = $this->getDataGenerator()->get_plugin_generator('mod_workshop');
1144
        $workshopgenerator = $this->getDataGenerator()->get_plugin_generator('mod_workshop');
1145
        $submissionid1 = $workshopgenerator->create_submission($this->workshop->id, $this->student->id);
1145
        $submissionid1 = $workshopgenerator->create_submission($this->workshop->id, $this->student->id);
1146
        $submissionid2 = $workshopgenerator->create_submission($this->workshop->id, $this->anotherstudentg1->id);
1146
        $submissionid2 = $workshopgenerator->create_submission($this->workshop->id, $this->anotherstudentg1->id);
Línea 1158... Línea 1158...
1158
 
1158
 
1159
 
1159
 
1160
    /**
1160
    /**
1161
     * Test get_submission_assessments_student.
1161
     * Test get_submission_assessments_student.
Línea 1162... Línea 1162...
1162
     */
1162
     */
1163
    public function test_get_submission_assessments_student() {
1163
    public function test_get_submission_assessments_student(): void {
Línea 1164... Línea 1164...
1164
 
1164
 
Línea 1193... Línea 1193...
1193
    }
1193
    }
Línea 1194... Línea 1194...
1194
 
1194
 
1195
    /**
1195
    /**
1196
     * Test get_submission_assessments_invalid_phase.
1196
     * Test get_submission_assessments_invalid_phase.
1197
     */
1197
     */
Línea 1198... Línea 1198...
1198
    public function test_get_submission_assessments_invalid_phase() {
1198
    public function test_get_submission_assessments_invalid_phase(): void {
1199
 
1199
 
Línea 1200... Línea 1200...
1200
        // Create the submission that will be deleted.
1200
        // Create the submission that will be deleted.
Línea 1211... Línea 1211...
1211
    }
1211
    }
Línea 1212... Línea 1212...
1212
 
1212
 
1213
    /**
1213
    /**
1214
     * Test get_submission_assessments_teacher.
1214
     * Test get_submission_assessments_teacher.
1215
     */
1215
     */
Línea 1216... Línea 1216...
1216
    public function test_get_submission_assessments_teacher() {
1216
    public function test_get_submission_assessments_teacher(): void {
1217
 
1217
 
Línea 1218... Línea 1218...
1218
        // Create the submission that will be deleted.
1218
        // Create the submission that will be deleted.
Línea 1233... Línea 1233...
1233
    }
1233
    }
Línea 1234... Línea 1234...
1234
 
1234
 
1235
    /**
1235
    /**
1236
     * Test get_assessment_author.
1236
     * Test get_assessment_author.
1237
     */
1237
     */
Línea 1238... Línea 1238...
1238
    public function test_get_assessment_author() {
1238
    public function test_get_assessment_author(): void {
1239
 
1239
 
Línea 1240... Línea 1240...
1240
        // Create the submission.
1240
        // Create the submission.
Línea 1259... Línea 1259...
1259
    }
1259
    }
Línea 1260... Línea 1260...
1260
 
1260
 
1261
    /**
1261
    /**
1262
     * Test get_assessment_reviewer.
1262
     * Test get_assessment_reviewer.
1263
     */
1263
     */
Línea 1264... Línea 1264...
1264
    public function test_get_assessment_reviewer() {
1264
    public function test_get_assessment_reviewer(): void {
1265
 
1265
 
Línea 1266... Línea 1266...
1266
        // Create the submission.
1266
        // Create the submission.
Línea 1285... Línea 1285...
1285
    }
1285
    }
Línea 1286... Línea 1286...
1286
 
1286
 
1287
    /**
1287
    /**
1288
     * Test get_assessment_teacher.
1288
     * Test get_assessment_teacher.
1289
     */
1289
     */
Línea 1290... Línea 1290...
1290
    public function test_get_assessment_teacher() {
1290
    public function test_get_assessment_teacher(): void {
1291
 
1291
 
Línea 1292... Línea 1292...
1292
        // Create the submission.
1292
        // Create the submission.
Línea 1309... Línea 1309...
1309
    }
1309
    }
Línea 1310... Línea 1310...
1310
 
1310
 
1311
    /**
1311
    /**
1312
     * Test get_assessment_student_invalid_phase.
1312
     * Test get_assessment_student_invalid_phase.
1313
     */
1313
     */
Línea 1314... Línea 1314...
1314
    public function test_get_assessment_student_invalid_phase() {
1314
    public function test_get_assessment_student_invalid_phase(): void {
1315
 
1315
 
Línea 1316... Línea 1316...
1316
        // Create the submission.
1316
        // Create the submission.
Línea 1330... Línea 1330...
1330
    }
1330
    }
Línea 1331... Línea 1331...
1331
 
1331
 
1332
    /**
1332
    /**
1333
     * Test get_assessment_student_invalid_user.
1333
     * Test get_assessment_student_invalid_user.
1334
     */
1334
     */
Línea 1335... Línea 1335...
1335
    public function test_get_assessment_student_invalid_user() {
1335
    public function test_get_assessment_student_invalid_user(): void {
1336
 
1336
 
Línea 1337... Línea 1337...
1337
        // Create the submission.
1337
        // Create the submission.
Línea 1353... Línea 1353...
1353
    }
1353
    }
Línea 1354... Línea 1354...
1354
 
1354
 
1355
    /**
1355
    /**
1356
     * Test get_assessment_form_definition_reviewer_new_assessment.
1356
     * Test get_assessment_form_definition_reviewer_new_assessment.
1357
     */
1357
     */
Línea 1358... Línea 1358...
1358
    public function test_get_assessment_form_definition_reviewer_new_assessment() {
1358
    public function test_get_assessment_form_definition_reviewer_new_assessment(): void {
1359
 
1359
 
Línea 1360... Línea 1360...
1360
        // Create the submission.
1360
        // Create the submission.
Línea 1386... Línea 1386...
1386
    }
1386
    }
Línea 1387... Línea 1387...
1387
 
1387
 
1388
    /**
1388
    /**
1389
     * Test get_assessment_form_definition_teacher_new_assessment.
1389
     * Test get_assessment_form_definition_teacher_new_assessment.
1390
     */
1390
     */
Línea 1391... Línea 1391...
1391
    public function test_get_assessment_form_definition_teacher_new_assessment() {
1391
    public function test_get_assessment_form_definition_teacher_new_assessment(): void {
1392
 
1392
 
Línea 1393... Línea 1393...
1393
        // Create the submission.
1393
        // Create the submission.
Línea 1407... Línea 1407...
1407
    }
1407
    }
Línea 1408... Línea 1408...
1408
 
1408
 
1409
    /**
1409
    /**
1410
     * Test get_assessment_form_definition_invalid_phase.
1410
     * Test get_assessment_form_definition_invalid_phase.
1411
     */
1411
     */
Línea 1412... Línea 1412...
1412
    public function test_get_assessment_form_definition_invalid_phase() {
1412
    public function test_get_assessment_form_definition_invalid_phase(): void {
1413
 
1413
 
Línea 1414... Línea 1414...
1414
        // Create the submission.
1414
        // Create the submission.
Línea 1426... Línea 1426...
1426
    }
1426
    }
Línea 1427... Línea 1427...
1427
 
1427
 
1428
    /**
1428
    /**
1429
     * Test get_reviewer_assessments.
1429
     * Test get_reviewer_assessments.
1430
     */
1430
     */
Línea 1431... Línea 1431...
1431
    public function test_get_reviewer_assessments() {
1431
    public function test_get_reviewer_assessments(): void {
1432
 
1432
 
1433
        // Create the submission.
1433
        // Create the submission.
Línea 1469... Línea 1469...
1469
    }
1469
    }
Línea 1470... Línea 1470...
1470
 
1470
 
1471
    /**
1471
    /**
1472
     * Test get_reviewer_assessments_other_student.
1472
     * Test get_reviewer_assessments_other_student.
1473
     */
1473
     */
Línea 1474... Línea 1474...
1474
    public function test_get_reviewer_assessments_other_student() {
1474
    public function test_get_reviewer_assessments_other_student(): void {
1475
 
1475
 
1476
        $workshop = new workshop($this->workshop, $this->cm, $this->course);
1476
        $workshop = new workshop($this->workshop, $this->cm, $this->course);
1477
        $workshop->switch_phase(workshop::PHASE_ASSESSMENT);
1477
        $workshop->switch_phase(workshop::PHASE_ASSESSMENT);
Línea 1482... Línea 1482...
1482
    }
1482
    }
Línea 1483... Línea 1483...
1483
 
1483
 
1484
    /**
1484
    /**
1485
     * Test get_reviewer_assessments_invalid_phase.
1485
     * Test get_reviewer_assessments_invalid_phase.
1486
     */
1486
     */
Línea 1487... Línea 1487...
1487
    public function test_get_reviewer_assessments_invalid_phase() {
1487
    public function test_get_reviewer_assessments_invalid_phase(): void {
1488
 
1488
 
1489
        $workshop = new workshop($this->workshop, $this->cm, $this->course);
1489
        $workshop = new workshop($this->workshop, $this->cm, $this->course);
1490
        $workshop->switch_phase(workshop::PHASE_SUBMISSION);
1490
        $workshop->switch_phase(workshop::PHASE_SUBMISSION);
Línea 1495... Línea 1495...
1495
    }
1495
    }
Línea 1496... Línea 1496...
1496
 
1496
 
1497
    /**
1497
    /**
1498
     * Test update_assessment.
1498
     * Test update_assessment.
1499
     */
1499
     */
Línea 1500... Línea 1500...
1500
    public function test_update_assessment() {
1500
    public function test_update_assessment(): void {
1501
 
1501
 
Línea 1502... Línea 1502...
1502
        // Create the submission.
1502
        // Create the submission.
Línea 1599... Línea 1599...
1599
    }
1599
    }
Línea 1600... Línea 1600...
1600
 
1600
 
1601
    /**
1601
    /**
1602
     * Test get_grades.
1602
     * Test get_grades.
1603
     */
1603
     */
Línea 1604... Línea 1604...
1604
    public function test_get_grades() {
1604
    public function test_get_grades(): void {
1605
 
1605
 
1606
        $timenow = time();
1606
        $timenow = time();
1607
        $submissiongrade = array(
1607
        $submissiongrade = array(
Línea 1649... Línea 1649...
1649
    }
1649
    }
Línea 1650... Línea 1650...
1650
 
1650
 
1651
    /**
1651
    /**
1652
     * Test get_grades_other_student.
1652
     * Test get_grades_other_student.
1653
     */
1653
     */
Línea 1654... Línea 1654...
1654
    public function test_get_grades_other_student() {
1654
    public function test_get_grades_other_student(): void {
1655
 
1655
 
Línea 1656... Línea 1656...
1656
        // Create the submission that will be deleted.
1656
        // Create the submission that will be deleted.
Línea 1664... Línea 1664...
1664
    }
1664
    }
Línea 1665... Línea 1665...
1665
 
1665
 
1666
    /**
1666
    /**
1667
     * Test evaluate_assessment.
1667
     * Test evaluate_assessment.
1668
     */
1668
     */
1669
    public function test_evaluate_assessment() {
1669
    public function test_evaluate_assessment(): void {
Línea 1670... Línea 1670...
1670
        global $DB;
1670
        global $DB;
1671
 
1671
 
1672
        $workshopgenerator = $this->getDataGenerator()->get_plugin_generator('mod_workshop');
1672
        $workshopgenerator = $this->getDataGenerator()->get_plugin_generator('mod_workshop');
Línea 1708... Línea 1708...
1708
    }
1708
    }
Línea 1709... Línea 1709...
1709
 
1709
 
1710
    /**
1710
    /**
1711
     * Test evaluate_assessment_ignore_parameters.
1711
     * Test evaluate_assessment_ignore_parameters.
1712
     */
1712
     */
1713
    public function test_evaluate_assessment_ignore_parameters() {
1713
    public function test_evaluate_assessment_ignore_parameters(): void {
1714
        $workshopgenerator = $this->getDataGenerator()->get_plugin_generator('mod_workshop');
1714
        $workshopgenerator = $this->getDataGenerator()->get_plugin_generator('mod_workshop');
1715
        $submissionid = $workshopgenerator->create_submission($this->workshop->id, $this->student->id);
1715
        $submissionid = $workshopgenerator->create_submission($this->workshop->id, $this->student->id);
1716
        $assessmentid = $workshopgenerator->create_assessment($submissionid, $this->anotherstudentg1->id, array(
1716
        $assessmentid = $workshopgenerator->create_assessment($submissionid, $this->anotherstudentg1->id, array(
1717
            'weight' => 3,
1717
            'weight' => 3,
Línea 1738... Línea 1738...
1738
    }
1738
    }
Línea 1739... Línea 1739...
1739
 
1739
 
1740
    /**
1740
    /**
1741
     * Test evaluate_assessment_no_permissions.
1741
     * Test evaluate_assessment_no_permissions.
1742
     */
1742
     */
1743
    public function test_evaluate_assessment_no_permissions() {
1743
    public function test_evaluate_assessment_no_permissions(): void {
1744
        $workshopgenerator = $this->getDataGenerator()->get_plugin_generator('mod_workshop');
1744
        $workshopgenerator = $this->getDataGenerator()->get_plugin_generator('mod_workshop');
1745
        $submissionid = $workshopgenerator->create_submission($this->workshop->id, $this->student->id);
1745
        $submissionid = $workshopgenerator->create_submission($this->workshop->id, $this->student->id);
1746
        $assessmentid = $workshopgenerator->create_assessment($submissionid, $this->anotherstudentg1->id, array(
1746
        $assessmentid = $workshopgenerator->create_assessment($submissionid, $this->anotherstudentg1->id, array(
1747
            'weight' => 3,
1747
            'weight' => 3,
Línea 1758... Línea 1758...
1758
    }
1758
    }
Línea 1759... Línea 1759...
1759
 
1759
 
1760
    /**
1760
    /**
1761
     * Test get_grades_report.
1761
     * Test get_grades_report.
1762
     */
1762
     */
Línea 1763... Línea 1763...
1763
    public function test_get_grades_report() {
1763
    public function test_get_grades_report(): void {
1764
 
1764
 
1765
        $workshop = new workshop($this->workshop, $this->cm, $this->course);
1765
        $workshop = new workshop($this->workshop, $this->cm, $this->course);
1766
        $workshopgenerator = $this->getDataGenerator()->get_plugin_generator('mod_workshop');
1766
        $workshopgenerator = $this->getDataGenerator()->get_plugin_generator('mod_workshop');
Línea 1808... Línea 1808...
1808
    }
1808
    }
Línea 1809... Línea 1809...
1809
 
1809
 
1810
    /**
1810
    /**
1811
     * Test get_grades_report_invalid_phase.
1811
     * Test get_grades_report_invalid_phase.
1812
     */
1812
     */
1813
    public function test_get_grades_report_invalid_phase() {
1813
    public function test_get_grades_report_invalid_phase(): void {
1814
        $this->setUser($this->teacher);
1814
        $this->setUser($this->teacher);
1815
        $this->expectException('moodle_exception');
1815
        $this->expectException('moodle_exception');
1816
        $this->expectExceptionMessage(get_string('nothingfound', 'workshop'));
1816
        $this->expectExceptionMessage(get_string('nothingfound', 'workshop'));
1817
        mod_workshop_external::get_grades_report($this->workshop->id);
1817
        mod_workshop_external::get_grades_report($this->workshop->id);
Línea 1818... Línea 1818...
1818
    }
1818
    }
1819
 
1819
 
1820
    /**
1820
    /**
1821
     * Test get_grades_report_missing_permissions.
1821
     * Test get_grades_report_missing_permissions.
1822
     */
1822
     */
1823
    public function test_get_grades_report_missing_permissions() {
1823
    public function test_get_grades_report_missing_permissions(): void {
1824
        $this->setUser($this->student);
1824
        $this->setUser($this->student);
1825
        $this->expectException('required_capability_exception');
1825
        $this->expectException('required_capability_exception');
Línea 1826... Línea 1826...
1826
        mod_workshop_external::get_grades_report($this->workshop->id);
1826
        mod_workshop_external::get_grades_report($this->workshop->id);
1827
    }
1827
    }
1828
 
1828
 
1829
    /**
1829
    /**
Línea 1830... Línea 1830...
1830
     * Test test_view_submission.
1830
     * Test test_view_submission.
1831
     */
1831
     */
Línea 1832... Línea 1832...
1832
    public function test_view_submission() {
1832
    public function test_view_submission(): void {
Línea 1857... Línea 1857...
1857
    }
1857
    }
Línea 1858... Línea 1858...
1858
 
1858
 
1859
    /**
1859
    /**
1860
     * Test evaluate_submission.
1860
     * Test evaluate_submission.
1861
     */
1861
     */
1862
    public function test_evaluate_submission() {
1862
    public function test_evaluate_submission(): void {
Línea 1863... Línea 1863...
1863
        global $DB;
1863
        global $DB;
1864
 
1864
 
Línea 1885... Línea 1885...
1885
    }
1885
    }
Línea 1886... Línea 1886...
1886
 
1886
 
1887
    /**
1887
    /**
1888
     * Test evaluate_submission_invalid_phase_for_override.
1888
     * Test evaluate_submission_invalid_phase_for_override.
1889
     */
1889
     */
1890
    public function test_evaluate_submission_invalid_phase_for_override() {
1890
    public function test_evaluate_submission_invalid_phase_for_override(): void {
Línea 1891... Línea 1891...
1891
        global $DB;
1891
        global $DB;
1892
 
1892
 
Línea 1910... Línea 1910...
1910
    }
1910
    }
Línea 1911... Línea 1911...
1911
 
1911
 
1912
    /**
1912
    /**
1913
     * Test evaluate_submission_no_permissions.
1913
     * Test evaluate_submission_no_permissions.
1914
     */
1914
     */
Línea 1915... Línea 1915...
1915
    public function test_evaluate_submission_no_permissions() {
1915
    public function test_evaluate_submission_no_permissions(): void {
1916
 
1916
 
1917
        $workshopgenerator = $this->getDataGenerator()->get_plugin_generator('mod_workshop');
1917
        $workshopgenerator = $this->getDataGenerator()->get_plugin_generator('mod_workshop');
1918
        $submissionid = $workshopgenerator->create_submission($this->workshop->id, $this->student->id);
1918
        $submissionid = $workshopgenerator->create_submission($this->workshop->id, $this->student->id);
Línea 1929... Línea 1929...
1929
    }
1929
    }
Línea 1930... Línea 1930...
1930
 
1930
 
1931
    /**
1931
    /**
1932
     * Test evaluate_submission_invalid_grade.
1932
     * Test evaluate_submission_invalid_grade.
1933
     */
1933
     */
Línea 1934... Línea 1934...
1934
    public function test_evaluate_submission_invalid_grade() {
1934
    public function test_evaluate_submission_invalid_grade(): void {
1935
 
1935
 
1936
        $workshopgenerator = $this->getDataGenerator()->get_plugin_generator('mod_workshop');
1936
        $workshopgenerator = $this->getDataGenerator()->get_plugin_generator('mod_workshop');
1937
        $submissionid = $workshopgenerator->create_submission($this->workshop->id, $this->student->id);
1937
        $submissionid = $workshopgenerator->create_submission($this->workshop->id, $this->student->id);