aboutsummaryrefslogtreecommitdiffstats
path: root/tests/lib/User
diff options
context:
space:
mode:
authorAbijeet <abijeetpatro@gmail.com>2017-12-16 17:18:05 +0530
committerAbijeet <abijeetpatro@gmail.com>2017-12-16 17:18:05 +0530
commitec28c54dbca77a3aad8d34a327c89458889f70ff (patch)
tree84d8295fcf892441f8a66aa09f6cbff8fa8bd71a /tests/lib/User
parentbd1e357eefee5ddfbb3b3567b0eae4f49bc22b75 (diff)
downloadnextcloud-server-ec28c54dbca77a3aad8d34a327c89458889f70ff.tar.gz
nextcloud-server-ec28c54dbca77a3aad8d34a327c89458889f70ff.zip
Adds search by email function on the users screen.
Fixes #7175. - Updated the query to fetch the users in users > everyone tab. - Updated the query to fetch the users in users > admin tab. - Tested to ensure that the disabled users are also being fetched. - Added test cases. Signed-off-by: Abijeet <abijeetpatro@gmail.com>
Diffstat (limited to 'tests/lib/User')
-rw-r--r--tests/lib/User/DatabaseTest.php25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/lib/User/DatabaseTest.php b/tests/lib/User/DatabaseTest.php
index 0e6900651cd..a1e77dc128d 100644
--- a/tests/lib/User/DatabaseTest.php
+++ b/tests/lib/User/DatabaseTest.php
@@ -24,6 +24,7 @@ namespace Test\User;
use OC\HintException;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\EventDispatcher\GenericEvent;
+use OC\User\User;
/**
* Class DatabaseTest
@@ -113,4 +114,28 @@ class DatabaseTest extends Backend {
$this->backend->createUser($user1, 'pw2');
$this->assertTrue($this->backend->userExists($user1));
}
+
+ public function testSearch() {
+ parent::testSearch();
+
+ $user1 = $this->getUser();
+ $this->backend->createUser($user1, 'pass1');
+
+ $user2 = $this->getUser();
+ $this->backend->createUser($user2, 'pass1');
+
+ $user1Obj = new User($user1, $this->backend);
+ $user2Obj = new User($user2, $this->backend);
+ $emailAddr1 = "$user1@nextcloud.com";
+ $emailAddr2 = "$user2@nextcloud.com";
+
+ $user1Obj->setEMailAddress($emailAddr1);
+ $user2Obj->setEMailAddress($emailAddr2);
+
+ $result = $this->backend->getUsers('@nextcloud.com');
+ $this->assertSame(2, count($result));
+
+ $result = $this->backend->getDisplayNames('@nextcloud.com');
+ $this->assertSame(2, count($result));
+ }
}