diff --git a/admin/tool/recyclebin/tests/behat/basic_functionality.feature b/admin/tool/recyclebin/tests/behat/basic_functionality.feature index 11f462316d0..65d773c84df 100644 --- a/admin/tool/recyclebin/tests/behat/basic_functionality.feature +++ b/admin/tool/recyclebin/tests/behat/basic_functionality.feature @@ -58,6 +58,7 @@ Feature: Basic recycle bin functionality And I am on "Course 1" course homepage And I should see "Test assign 1" in the "Topic 1" "section" + @javascript Scenario: Restore a deleted course Given I log in as "admin" And I go to the courses management page diff --git a/course/delete.php b/course/delete.php index c4a942ffe9c..99bc99ace0c 100644 --- a/course/delete.php +++ b/course/delete.php @@ -22,6 +22,8 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +define('NO_OUTPUT_BUFFERING', true); + require_once(__DIR__ . '/../config.php'); require_once($CFG->dirroot . '/course/lib.php'); require_once($CFG->dirroot . '/backup/util/includes/backup_includes.php'); @@ -64,13 +66,20 @@ if ($delete === md5($course->timemodified)) { echo $OUTPUT->heading($strdeletingcourse); // This might take a while. Raise the execution time limit. core_php_time_limit::raise(); + // We do this here because it spits out feedback as it goes. + echo $OUTPUT->footer(); + echo $OUTPUT->select_element_for_append(); + + // Preemptively reset the navcache before closing, so it remains the same on shutdown. + navigation_cache::destroy_volatile_caches(); + \core\session\manager::write_close(); + delete_course($course); echo $OUTPUT->heading( get_string("deletedcourse", "", $courseshortname) ); // Update course count in categories. fix_course_sortorder(); echo $OUTPUT->continue_button($categoryurl); - echo $OUTPUT->footer(); exit; // We must exit here!!! } diff --git a/course/tests/behat/create_delete_course.feature b/course/tests/behat/create_delete_course.feature index fde89630b3f..f3e465698d0 100644 --- a/course/tests/behat/create_delete_course.feature +++ b/course/tests/behat/create_delete_course.feature @@ -32,6 +32,7 @@ Feature: Test we can both create and delete a course. And I should see "Cat 1" in the "#category-listing" "css_element" And I should see "Test course: create a course" in the "#course-listing" "css_element" + @javascript Scenario: Delete a course via its management listing Given the following "categories" exist: | name | category 0| idnumber | @@ -64,6 +65,7 @@ Feature: Test we can both create and delete a course. And I should see "Cat 1" in the "#category-listing" "css_element" And I should see "Test course 2: create another course" in the "#course-listing" "css_element" + @javascript Scenario: Delete a course via its management details page Given the following "categories" exist: | name | category 0| idnumber |