MDL-44279 user: added unit test to trigger known bug
authorSam Hemelryk <sam@moodle.com>
Wed, 19 Feb 2014 20:53:36 +0000 (09:53 +1300)
committerSam Hemelryk <sam@moodle.com>
Thu, 20 Feb 2014 19:34:49 +0000 (08:34 +1300)
user/tests/externallib_test.php

index 9405a77..394af1c 100644 (file)
@@ -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));
     }
 
     /**