Skip to content

Commit 17c1519

Browse files
committed
MDL-81714 tool_recyclebin: Remove unnecessary task runs in tests
I assume that it was necessary at some point to run the ad-hoc tasks in these tests, however the only task now being run is regrade_final_grades, which causes the tests to fail due as they produce output. Whether the regrade is performed or not has no impact on the result of the test, so removing the ad-hoc task run seems appropriate.
1 parent 462e97c commit 17c1519

File tree

1 file changed

+0
-17
lines changed

1 file changed

+0
-17
lines changed

admin/tool/recyclebin/tests/course_bin_test.php

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,6 @@ public function test_pre_course_module_delete_hook() {
6666
// Delete the course module.
6767
course_delete_module($this->quiz->cmid);
6868

69-
// Now, run the course module deletion adhoc task.
70-
\phpunit_util::run_all_adhoc_tasks();
71-
7269
// Check the course module is now in the recycle bin.
7370
$this->assertEquals(1, $DB->count_records('tool_recyclebin_course'));
7471

@@ -110,9 +107,6 @@ public function test_delete() {
110107
// Delete the course module.
111108
course_delete_module($this->quiz->cmid);
112109

113-
// Now, run the course module deletion adhoc task.
114-
\phpunit_util::run_all_adhoc_tasks();
115-
116110
// Try purging.
117111
$recyclebin = new \tool_recyclebin\course_bin($this->course->id);
118112
foreach ($recyclebin->get_items() as $item) {
@@ -135,9 +129,6 @@ public function test_cleanup_task() {
135129
// Delete the quiz.
136130
course_delete_module($this->quiz->cmid);
137131

138-
// Now, run the course module deletion adhoc task.
139-
\phpunit_util::run_all_adhoc_tasks();
140-
141132
// Set deleted date to the distant past.
142133
$recyclebin = new \tool_recyclebin\course_bin($this->course->id);
143134
foreach ($recyclebin->get_items() as $item) {
@@ -151,9 +142,6 @@ public function test_cleanup_task() {
151142

152143
course_delete_module($book->cmid);
153144

154-
// Now, run the course module deletion adhoc task.
155-
\phpunit_util::run_all_adhoc_tasks();
156-
157145
// Should have 2 items now.
158146
$this->assertEquals(2, count($recyclebin->get_items()));
159147

@@ -223,7 +211,6 @@ public function test_coursemodule_restore_with_userdata($settings) {
223211
// Delete quiz.
224212
$cm = get_coursemodule_from_instance('quiz', $this->quiz->id);
225213
course_delete_module($cm->id);
226-
\phpunit_util::run_all_adhoc_tasks();
227214
$quizzes = get_coursemodules_in_course('quiz', $this->course->id);
228215
$this->assertEquals(0, count($quizzes));
229216

@@ -260,9 +247,6 @@ public function test_coursemodule_restore_with_activity_setting_disabled() {
260247
// Delete the course module.
261248
course_delete_module($this->quiz->cmid);
262249

263-
// Now, run the course module deletion adhoc task.
264-
\phpunit_util::run_all_adhoc_tasks();
265-
266250
// Check there is no items in the recycle bin.
267251
$recyclebin = new \tool_recyclebin\course_bin($this->course->id);
268252
$this->assertEquals(0, count($recyclebin->get_items()));
@@ -293,7 +277,6 @@ public function test_coursemodule_restore_without_userdata($settings) {
293277
// Delete quiz.
294278
$cm = get_coursemodule_from_instance('quiz', $this->quiz->id);
295279
course_delete_module($cm->id);
296-
\phpunit_util::run_all_adhoc_tasks();
297280
$quizzes = get_coursemodules_in_course('quiz', $this->course->id);
298281
$this->assertEquals(0, count($quizzes));
299282

0 commit comments

Comments
 (0)