diff --git a/core/modules/user/lib/Drupal/user/Tests/UserAutocompleteTest.php b/core/modules/user/lib/Drupal/user/Tests/UserAutocompleteTest.php index eda2685..5679b18 100644 --- a/core/modules/user/lib/Drupal/user/Tests/UserAutocompleteTest.php +++ b/core/modules/user/lib/Drupal/user/Tests/UserAutocompleteTest.php @@ -48,7 +48,7 @@ function testUserAutocomplete() { $this->assertRaw($this->unprivileged_user->name, 'User name found in autocompletion results.'); // Test that anonymous username is in the result. - $anonymous_name = $this->randomName(); + $anonymous_name = $this->randomString(); config('user.settings')->set('anonymous', $anonymous_name)->save(); $this->drupalGet('user/autocomplete', array('query' => array('q' => drupal_substr($anonymous_name, 0, 4), 'anonymous' => '1'))); $this->assertRaw($anonymous_name, 'The anonymous name found in autocompletion results.'); diff --git a/core/modules/user/user.pages.inc b/core/modules/user/user.pages.inc index 9fa30e3..b1473ef 100644 --- a/core/modules/user/user.pages.inc +++ b/core/modules/user/user.pages.inc @@ -14,6 +14,15 @@ /** * Menu callback for user autocompletion. * + * Like other autocomplete functions, this function inspects the 'q' query + * parameter for the string to use to search for suggestions. If the name used + * to indicate anonymous users (e.g. "Anonymous") is to be included as a + * possible suggestion, the 'anonymous' query parameter should be set + * additionally. For example, http://example.com/user/autocomplete?q=An might + * return "Andrew" and "Anne", while + * http://example.com/user/autocomplete?q=An&anonymous=1 will additionally + * return "Anonymous". + * * @return \Symfony\Component\HttpFoundation\JsonResponse * A JSON response containing the autocomplete suggestions for existing users. */