summaryrefslogtreecommitdiffstats
path: root/tests/lib/user
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@owncloud.com>2014-06-23 18:33:13 +0200
committerArthur Schiwon <blizzz@owncloud.com>2014-06-23 18:33:13 +0200
commit5dab762006e25407d7df2bceb00b4960a01d317d (patch)
tree33a1c2fe0054f134aa54e7ba6f6fec8c3cae85e1 /tests/lib/user
parent01a012980afa1bed5b2db1006a9d6443f19e3d5f (diff)
downloadnextcloud-server-5dab762006e25407d7df2bceb00b4960a01d317d.tar.gz
nextcloud-server-5dab762006e25407d7df2bceb00b4960a01d317d.zip
add tests
Diffstat (limited to 'tests/lib/user')
-rw-r--r--tests/lib/user/backend.php17
-rw-r--r--tests/lib/user/database.php3
2 files changed, 20 insertions, 0 deletions
diff --git a/tests/lib/user/backend.php b/tests/lib/user/backend.php
index 1384c54a921..0d3914c7ca6 100644
--- a/tests/lib/user/backend.php
+++ b/tests/lib/user/backend.php
@@ -96,4 +96,21 @@ abstract class Test_User_Backend extends PHPUnit_Framework_TestCase {
$this->assertSame($name1, $this->backend->checkPassword($name1, 'newpass1'));
$this->assertFalse($this->backend->checkPassword($name2, 'newpass1'));
}
+
+ public function testSearch() {
+ $name1 = 'foobarbaz';
+ $name2 = 'bazbarfoo';
+ $name3 = 'notme';
+
+ $this->backend->createUser($name1, 'pass1');
+ $this->backend->createUser($name2, 'pass2');
+ $this->backend->createUser($name3, 'pass3');
+
+ $result = $this->backend->getUsers('bar');
+ $this->assertSame(2, count($result));
+
+ $result = $this->backend->getDisplayNames('bar');
+ $this->assertSame(2, count($result));
+ }
+
}
diff --git a/tests/lib/user/database.php b/tests/lib/user/database.php
index d7cc39ae387..a8e497720c2 100644
--- a/tests/lib/user/database.php
+++ b/tests/lib/user/database.php
@@ -32,6 +32,9 @@ class Test_User_Database extends Test_User_Backend {
}
public function tearDown() {
+ if(!isset($this->users)) {
+ return;
+ }
foreach($this->users as $user) {
$this->backend->deleteUser($user);
}