MDL-72094 core_report: Deprecate report_helper::save_selected_report()

This commit is contained in:
Mihail Geshoski 2021-08-17 10:21:24 +08:00
parent 1dc3fa2c55
commit 87a577aade
3 changed files with 12 additions and 0 deletions

View File

@ -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 = [];

View File

@ -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);
}

View File

@ -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