Skip to content

Commit

Permalink
MDL-81714 tool_recyclebin: Remove unnecessary task runs in tests
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
marxjohnson committed May 15, 2024
1 parent 462e97c commit 17c1519
Showing 1 changed file with 0 additions and 17 deletions.
17 changes: 0 additions & 17 deletions admin/tool/recyclebin/tests/course_bin_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,6 @@ public function test_pre_course_module_delete_hook() {
// Delete the course module.
course_delete_module($this->quiz->cmid);

// Now, run the course module deletion adhoc task.
\phpunit_util::run_all_adhoc_tasks();

// Check the course module is now in the recycle bin.
$this->assertEquals(1, $DB->count_records('tool_recyclebin_course'));

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

// Now, run the course module deletion adhoc task.
\phpunit_util::run_all_adhoc_tasks();

// Try purging.
$recyclebin = new \tool_recyclebin\course_bin($this->course->id);
foreach ($recyclebin->get_items() as $item) {
Expand All @@ -135,9 +129,6 @@ public function test_cleanup_task() {
// Delete the quiz.
course_delete_module($this->quiz->cmid);

// Now, run the course module deletion adhoc task.
\phpunit_util::run_all_adhoc_tasks();

// Set deleted date to the distant past.
$recyclebin = new \tool_recyclebin\course_bin($this->course->id);
foreach ($recyclebin->get_items() as $item) {
Expand All @@ -151,9 +142,6 @@ public function test_cleanup_task() {

course_delete_module($book->cmid);

// Now, run the course module deletion adhoc task.
\phpunit_util::run_all_adhoc_tasks();

// Should have 2 items now.
$this->assertEquals(2, count($recyclebin->get_items()));

Expand Down Expand Up @@ -223,7 +211,6 @@ public function test_coursemodule_restore_with_userdata($settings) {
// Delete quiz.
$cm = get_coursemodule_from_instance('quiz', $this->quiz->id);
course_delete_module($cm->id);
\phpunit_util::run_all_adhoc_tasks();
$quizzes = get_coursemodules_in_course('quiz', $this->course->id);
$this->assertEquals(0, count($quizzes));

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

// Now, run the course module deletion adhoc task.
\phpunit_util::run_all_adhoc_tasks();

// Check there is no items in the recycle bin.
$recyclebin = new \tool_recyclebin\course_bin($this->course->id);
$this->assertEquals(0, count($recyclebin->get_items()));
Expand Down Expand Up @@ -293,7 +277,6 @@ public function test_coursemodule_restore_without_userdata($settings) {
// Delete quiz.
$cm = get_coursemodule_from_instance('quiz', $this->quiz->id);
course_delete_module($cm->id);
\phpunit_util::run_all_adhoc_tasks();
$quizzes = get_coursemodules_in_course('quiz', $this->course->id);
$this->assertEquals(0, count($quizzes));

Expand Down

0 comments on commit 17c1519

Please sign in to comment.