MDL-84042 mod_assign: Notification helper tests cleanup

This commit is contained in:
Huong Nguyen 2025-01-08 09:18:41 +07:00
parent fcab82c2dd
commit 59679f6daf
No known key found for this signature in database
GPG Key ID: 40D88AB693A3E72A
2 changed files with 13 additions and 1 deletions

View File

@ -126,7 +126,6 @@ class mod_assign_generator extends testing_module_generator {
if (array_key_exists($pluginname, $data)) {
$plugingenerator = $this->datagenerator->get_plugin_generator("assignsubmission_{$pluginname}");
$plugingenerator->add_submission_data($submission, $assign, $data);
$plugin->enable();
}
}

View File

@ -107,6 +107,7 @@ final class notification_helper_test extends \advanced_testcase {
'course' => $course->id,
'duedate' => $duedate,
'submissiondrafts' => 0,
'assignsubmission_onlinetext_enabled' => 1,
]);
// User1 will have a user override, giving them an extra 1 hour for 'duedate'.
@ -142,6 +143,7 @@ final class notification_helper_test extends \advanced_testcase {
'status' => 'submitted',
'timemodified' => $clock->time(),
'onlinetext' => 'Some text',
'assignsubmission_onlinetext_enabled' => 1,
]);
// There should be 3 users with the teacher excluded.
@ -174,6 +176,7 @@ final class notification_helper_test extends \advanced_testcase {
'course' => $course->id,
'duedate' => $duedate,
'submissiondrafts' => 0,
'assignsubmission_onlinetext_enabled' => 1,
]);
$clock->bump(5);
@ -337,6 +340,7 @@ final class notification_helper_test extends \advanced_testcase {
'course' => $course->id,
'duedate' => $duedate,
'submissiondrafts' => 0,
'assignsubmission_onlinetext_enabled' => 1,
]);
// User1 will have a user override, giving them an extra minute for 'duedate'.
@ -373,6 +377,7 @@ final class notification_helper_test extends \advanced_testcase {
'status' => 'submitted',
'timemodified' => $clock->time(),
'onlinetext' => 'Some text',
'assignsubmission_onlinetext_enabled' => 1,
]);
// User6 will have a cut-off date override that has already lapsed, excluding them from the results.
@ -416,6 +421,7 @@ final class notification_helper_test extends \advanced_testcase {
'duedate' => $duedate,
'cutoffdate' => $cutoffdate,
'submissiondrafts' => 0,
'assignsubmission_onlinetext_enabled' => 1,
]);
$clock->bump(5);
@ -490,6 +496,7 @@ final class notification_helper_test extends \advanced_testcase {
'status' => 'submitted',
'timemodified' => $clock->time(),
'onlinetext' => 'Some text',
'assignsubmission_onlinetext_enabled' => 1,
]);
// Clear sink.
@ -551,6 +558,7 @@ final class notification_helper_test extends \advanced_testcase {
'course' => $course->id,
'duedate' => $duedate,
'submissiondrafts' => 0,
'assignsubmission_onlinetext_enabled' => 1,
]);
// User1 will have a user override, giving them an extra 1 day for 'duedate', excluding them from the results.
@ -579,6 +587,7 @@ final class notification_helper_test extends \advanced_testcase {
'status' => 'submitted',
'timemodified' => $clock->time(),
'onlinetext' => 'Some text',
'assignsubmission_onlinetext_enabled' => 1,
]);
// There should be 1 user with the teacher excluded.
@ -610,18 +619,21 @@ final class notification_helper_test extends \advanced_testcase {
'course' => $course->id,
'duedate' => $duedate1,
'submissiondrafts' => 0,
'assignsubmission_onlinetext_enabled' => 1,
]);
$duedate2 = $clock->time() + WEEKSECS;
$assignment2 = $assignmentgenerator->create_instance([
'course' => $course->id,
'duedate' => $duedate2,
'submissiondrafts' => 0,
'assignsubmission_onlinetext_enabled' => 1,
]);
$duedate3 = $clock->time() + WEEKSECS + DAYSECS;
$assignment3 = $assignmentgenerator->create_instance([
'course' => $course->id,
'duedate' => $duedate3,
'submissiondrafts' => 0,
'assignsubmission_onlinetext_enabled' => 1,
]);
$clock->bump(5);
@ -675,6 +687,7 @@ final class notification_helper_test extends \advanced_testcase {
'status' => 'submitted',
'timemodified' => $clock->time(),
'onlinetext' => 'Some text',
'assignsubmission_onlinetext_enabled' => 1,
]);
$clock->bump(5);