diff --git a/user/tests/externallib_test.php b/user/tests/externallib_test.php index 9405a77e529..394af1c5269 100644 --- a/user/tests/externallib_test.php +++ b/user/tests/externallib_test.php @@ -341,6 +341,16 @@ class core_user_externallib_testcase extends externallib_advanced_testcase { // Only the own $USER username should be returned $this->assertEquals(1, count($returnedusers)); + + // And finally test as one of the enrolled users. + $this->setUser($user1); + + // Call the external function. + $returnedusers = core_user_external::get_users_by_field('username', + array($USER->username, $user1->username, $user2->username)); + + // Only the own $USER username should be returned still. + $this->assertEquals(1, count($returnedusers)); } /**