MDL-52214 core: Fix the is_web_crawler() regression

In MDL-50891, the is_web_crawler() was refactored into a core_useragent
method and the function itself was deprecated. However, there were no
unit tests kept to check the backwards compatible behaviour. It turned
out that the deprecated function leads to PHP fatal error due to a typo.

This patch fixes the typo and brings back the previous unit tests. To be
able to explicitly check the raised debugging message, the test case
now must be subclass of advanced_testcase.

Additionally fixes missing info about the function being deprecated.
This commit is contained in:
David Mudrák
2015-11-23 09:42:27 +01:00
parent f0aa5b7e3b
commit f554e04a27
3 changed files with 61 additions and 3 deletions
+2 -2
View File
@@ -2395,8 +2395,8 @@ function get_referer($stripquery = true) {
* @deprecated since Moodle 3.0 use \core_useragent::is_web_crawler instead.
*/
function is_web_crawler() {
debugging("is_web_crawler() has been deprecated, please use \\core_useragent\\is_web_crawler() instead.", DEBUG_DEVELOPER);
return core_useragent::is_crawler();
debugging('is_web_crawler() has been deprecated, please use core_useragent::is_web_crawler() instead.', DEBUG_DEVELOPER);
return core_useragent::is_web_crawler();
}
/**