From 87a577aade1a29b9e30d4c1b5dc57c82e3544792 Mon Sep 17 00:00:00 2001 From: Mihail Geshoski Date: Tue, 17 Aug 2021 10:21:24 +0800 Subject: [PATCH] MDL-72094 core_report: Deprecate report_helper::save_selected_report() --- lib/classes/report_helper.php | 4 ++++ lib/tests/report_helper_test.php | 4 ++++ report/upgrade.txt | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/lib/classes/report_helper.php b/lib/classes/report_helper.php index b31fbab99a7..10cdaeafefc 100644 --- a/lib/classes/report_helper.php +++ b/lib/classes/report_helper.php @@ -71,6 +71,7 @@ class report_helper { /** * Save the last selected report in the session * + * @deprecated since Moodle 4.0 * @param int $id The course id * @param moodle_url $url The moodle url * @return void @@ -78,6 +79,9 @@ class report_helper { public static function save_selected_report(int $id, moodle_url $url):void { global $USER; + debugging('save_selected_report() has been deprecated because it is no longer used and will be '. + 'removed in future versions of Moodle', DEBUG_DEVELOPER); + // Last selected report. if (!isset($USER->course_last_report)) { $USER->course_last_report = []; diff --git a/lib/tests/report_helper_test.php b/lib/tests/report_helper_test.php index 4c2595ba331..9abe4d637c5 100644 --- a/lib/tests/report_helper_test.php +++ b/lib/tests/report_helper_test.php @@ -62,12 +62,16 @@ class report_helper_test extends \advanced_testcase { $url1 = new moodle_url($courseurlid[0]['url']); $courseid1 = $courseurlid[0]['id']; report_helper::save_selected_report($courseid1, $url1); + $this->assertDebuggingCalled('save_selected_report() has been deprecated because it is no ' . + 'longer used and will be removed in future versions of Moodle'); $this->assertEquals($USER->course_last_report[$courseid1], $url1); $url2 = new moodle_url($courseurlid[1]['url']); $courseid2 = $courseurlid[1]['id']; report_helper::save_selected_report($courseid2, $url2); + $this->assertDebuggingCalled('save_selected_report() has been deprecated because it is no ' . + 'longer used and will be removed in future versions of Moodle'); $this->assertEquals($USER->course_last_report[$courseid2], $url2); } diff --git a/report/upgrade.txt b/report/upgrade.txt index 341fed59e5f..7cb53b41a19 100644 --- a/report/upgrade.txt +++ b/report/upgrade.txt @@ -1,6 +1,10 @@ This files describes API changes in /report/* - plugins, information provided here is intended especially for developers. +=== 4.0 === + +* The method report_helper::save_selected_report() has been been deprecated because it is no longer used. + === 3.11 === * The new report plugin's can have drop down, which can be included by calling static