[Pkg-owncloud-commits] [owncloud] 30/273: add tests
David Prévot
taffit at moszumanska.debian.org
Fri Jul 4 03:12:54 UTC 2014
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository owncloud.
commit 5dab762006e25407d7df2bceb00b4960a01d317d
Author: Arthur Schiwon <blizzz at owncloud.com>
Date: Mon Jun 23 18:33:13 2014 +0200
add tests
---
tests/lib/group/backend.php | 39 ++++++++++++++++++++++++++++++++++++++-
tests/lib/user/backend.php | 17 +++++++++++++++++
tests/lib/user/database.php | 3 +++
3 files changed, 58 insertions(+), 1 deletion(-)
diff --git a/tests/lib/group/backend.php b/tests/lib/group/backend.php
index 2c563ae..b6e3fa2 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);
+ }
+
+
}
diff --git a/tests/lib/user/backend.php b/tests/lib/user/backend.php
index 1384c54..0d3914c 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 d7cc39a..a8e4977 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);
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git
More information about the Pkg-owncloud-commits
mailing list