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.
This commit is contained in:
Mark Johnson
2025-03-14 16:01:05 +00:00
parent b746bcd186
commit f96965b930
@@ -67,9 +67,6 @@ final class course_bin_test extends \advanced_testcase {
// 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'));
@@ -111,9 +108,6 @@ final class course_bin_test extends \advanced_testcase {
// 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) {
@@ -136,9 +130,6 @@ final class course_bin_test extends \advanced_testcase {
// 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) {
@@ -152,9 +143,6 @@ final class course_bin_test extends \advanced_testcase {
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()));
@@ -224,7 +212,6 @@ final class course_bin_test extends \advanced_testcase {
// 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));
@@ -261,9 +248,6 @@ final class course_bin_test extends \advanced_testcase {
// 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()));
@@ -294,7 +278,6 @@ final class course_bin_test extends \advanced_testcase {
// 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));