summaryrefslogtreecommitdiffstats
path: root/tests/lib/group
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/group
parent01a012980afa1bed5b2db1006a9d6443f19e3d5f (diff)
downloadnextcloud-server-5dab762006e25407d7df2bceb00b4960a01d317d.tar.gz
nextcloud-server-5dab762006e25407d7df2bceb00b4960a01d317d.zip
add tests
Diffstat (limited to 'tests/lib/group')
-rw-r--r--tests/lib/group/backend.php39
1 files changed, 38 insertions, 1 deletions
diff --git a/tests/lib/group/backend.php b/tests/lib/group/backend.php
index 2c563ae9ac9..b6e3fa2b003 100644
--- a/tests/lib/group/backend.php
+++ b/tests/lib/group/backend.php
@@ -88,7 +88,7 @@ abstract class Test_Group_Backend extends PHPUnit_Framework_TestCase {
$this->assertFalse($this->backend->inGroup($user2, $group1));
$this->assertFalse($this->backend->inGroup($user1, $group2));
$this->assertFalse($this->backend->inGroup($user2, $group2));
-
+
$this->assertFalse($this->backend->addToGroup($user1, $group1));
$this->assertEquals(array($user1), $this->backend->usersInGroup($group1));
@@ -102,4 +102,41 @@ abstract class Test_Group_Backend extends PHPUnit_Framework_TestCase {
$this->assertEquals(array(), $this->backend->usersInGroup($group1));
$this->assertFalse($this->backend->inGroup($user1, $group1));
}
+
+ public function testSearchGroups() {
+ $name1 = 'foobarbaz';
+ $name2 = 'bazbarfoo';
+ $name3 = 'notme';
+
+ $this->backend->createGroup($name1);
+ $this->backend->createGroup($name2);
+ $this->backend->createGroup($name3);
+
+ $result = $this->backend->getGroups('bar');
+ $this->assertSame(2, count($result));
+
+ $result = $this->backend->getDisplayNames('bar');
+ $this->assertSame(2, count($result));
+ }
+
+ public function testSearchUsers() {
+ $group = $this->getGroupName();
+ $this->backend->createGroup($group);
+
+ $name1 = 'foobarbaz';
+ $name2 = 'bazbarfoo';
+ $name3 = 'notme';
+
+ $this->backend->addToGroup($group, $name1);
+ $this->backend->addToGroup($group, $name2);
+ $this->backend->addToGroup($group, $name3);
+
+ $result = $this->backend->usersInGroup($group, 'bar');
+ $this->assertSame(2, count($result));
+
+ $result = $this->backend->countUsersInGroup($group, 'bar');
+ $this->assertSame(2, $result);
+ }
+
+
}