summaryrefslogtreecommitdiff
path: root/modules/user/user.test
diff options
context:
space:
mode:
Diffstat (limited to 'modules/user/user.test')
-rw-r--r--modules/user/user.test33
1 files changed, 33 insertions, 0 deletions
diff --git a/modules/user/user.test b/modules/user/user.test
index 903fd16bf..78e121672 100644
--- a/modules/user/user.test
+++ b/modules/user/user.test
@@ -1585,3 +1585,36 @@ class UserTokenReplaceTestCase extends DrupalWebTestCase {
}
}
}
+
+/**
+ * Test user search.
+ */
+class UserUserSearchTestCase extends DrupalWebTestCase {
+ public static function getInfo() {
+ return array(
+ 'name' => 'User search',
+ 'description' => 'Testing that only user with the right permission can see the email address in the user search.',
+ 'group' => 'User',
+ );
+ }
+
+ function testUserSearch() {
+ $user1 = $this->drupalCreateUser(array('access user profiles', 'search content', 'use advanced search'));
+ $this->drupalLogin($user1);
+ $keys = $user1->mail;
+ $edit = array('keys' => $keys);
+ $this->drupalPost('search/user/', $edit, t('Search'));
+ $this->assertNoText($keys);
+ $this->drupalLogout();
+
+ $user2 = $this->drupalCreateUser(array('administer users', 'access user profiles', 'search content', 'use advanced search'));
+ $this->drupalLogin($user2);
+ $keys = $user2->mail;
+ $edit = array('keys' => $keys);
+ $this->drupalPost('search/user/', $edit, t('Search'));
+ $this->assertText($keys);
+ $this->drupalLogout();
+ }
+}
+
+