From e61a9638f115c166f6f65a714218098f99b9474e Mon Sep 17 00:00:00 2001 From: Mark Nielsen Date: Fri, 20 Nov 2015 13:55:27 -0800 Subject: [PATCH] MDL-52060 phpunit: Improve get_message_processors reset --- lib/phpunit/classes/util.php | 2 +- message/lib.php | 7 ++++++- message/upgrade.txt | 3 +++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/phpunit/classes/util.php b/lib/phpunit/classes/util.php index 2321e4abafa..0da8931c898 100644 --- a/lib/phpunit/classes/util.php +++ b/lib/phpunit/classes/util.php @@ -207,7 +207,7 @@ class phpunit_util extends testing_util { reset_text_filters_cache(true); events_get_handlers('reset'); core_text::reset_caches(); - get_message_processors(false, true); + get_message_processors(false, true, true); filter_manager::reset_caches(); core_filetypes::reset_caches(); diff --git a/message/lib.php b/message/lib.php index e038f4e0686..52d2b7732dc 100644 --- a/message/lib.php +++ b/message/lib.php @@ -2571,14 +2571,19 @@ function message_mark_message_read($message, $timeread, $messageworkingempty=fal * * @param bool $ready only return ready-to-use processors * @param bool $reset Reset list of message processors (used in unit tests) + * @param bool $resetonly Just reset, then exit * @return mixed $processors array of objects containing information on message processors */ -function get_message_processors($ready = false, $reset = false) { +function get_message_processors($ready = false, $reset = false, $resetonly = false) { global $DB, $CFG; static $processors; if ($reset) { $processors = array(); + + if ($resetonly) { + return $processors; + } } if (empty($processors)) { diff --git a/message/upgrade.txt b/message/upgrade.txt index 91906a46407..24604cb05bb 100644 --- a/message/upgrade.txt +++ b/message/upgrade.txt @@ -1,6 +1,9 @@ This files describes API changes in /message/ messaging system, information provided here is intended especially for developers. +=== 3.1 === +* get_message_processors accepts an addition parameter for testing, which will just reset processor and exit. + === 2.9 === * Renderer method \core_message_renderer::manage_messagingoptions now accepts a user id parameter as well. -- 2.43.0