diff --git a/lib/tests/user_test.php b/lib/tests/user_test.php index 03192a5c652..7aea5a4ec53 100644 --- a/lib/tests/user_test.php +++ b/lib/tests/user_test.php @@ -404,4 +404,28 @@ class core_user_testcase extends advanced_testcase { $this->setExpectedException('coding_exception', 'Invalid property requested, or the property does not has a default value.'); core_user::get_property_default('firstname'); } + + /** + * Ensure that the noreply user is not cached. + */ + public function test_get_noreply_user() { + global $CFG; + + // Create a new fake language 'xx' with the 'noreplyname'. + $langfolder = $CFG->dataroot . '/lang/xx'; + check_dir_exists($langfolder); + $langconfig = "lang='en'; + $enuser = \core_user::get_noreply_user(); + + $CFG->lang='xx'; + $xxuser = \core_user::get_noreply_user(); + + $this->assertNotEquals($enuser, $xxuser); + } + }