summaryrefslogtreecommitdiffstats
path: root/apps/user_ldap/tests
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@arthur-schiwon.de>2020-08-11 18:53:50 +0200
committerArthur Schiwon <blizzz@arthur-schiwon.de>2020-08-11 19:03:27 +0200
commit7eb6d8df0add6c862e84bdb0bb618380fbc04bda (patch)
tree8af276103fc3fa7cf3c4b29f80e74ae93b4a3061 /apps/user_ldap/tests
parent7ea262dba03cceefe0646f2216b506d66c3dcbc9 (diff)
downloadnextcloud-server-7eb6d8df0add6c862e84bdb0bb618380fbc04bda.tar.gz
nextcloud-server-7eb6d8df0add6c862e84bdb0bb618380fbc04bda.zip
do not flip available state to unavailable, allow empty results
- the detection relies that the first, requested result is not empty - it might be empty though – groups without members - protect switching from available to unavailable - switching the other way around was also not envisaged either Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Diffstat (limited to 'apps/user_ldap/tests')
-rw-r--r--apps/user_ldap/tests/Group_LDAPTest.php22
1 files changed, 20 insertions, 2 deletions
diff --git a/apps/user_ldap/tests/Group_LDAPTest.php b/apps/user_ldap/tests/Group_LDAPTest.php
index 3143054940d..4ddf9f5247c 100644
--- a/apps/user_ldap/tests/Group_LDAPTest.php
+++ b/apps/user_ldap/tests/Group_LDAPTest.php
@@ -129,6 +129,10 @@ class Group_LDAPTest extends TestCase {
->method('countUsers')
->willReturn(2);
+ $access->userManager->expects($this->any())
+ ->method('getAttributes')
+ ->willReturn(['displayName', 'mail']);
+
$groupBackend = new GroupLDAP($access, $pluginManager);
$users = $groupBackend->countUsersInGroup('group');
@@ -172,6 +176,10 @@ class Group_LDAPTest extends TestCase {
->method('escapeFilterPart')
->willReturnArgument(0);
+ $access->userManager->expects($this->any())
+ ->method('getAttributes')
+ ->willReturn(['displayName', 'mail']);
+
$groupBackend = new GroupLDAP($access, $pluginManager);
$users = $groupBackend->countUsersInGroup('group', '3');
@@ -546,7 +554,10 @@ class Group_LDAPTest extends TestCase {
$access->expects($this->any())
->method('combineFilterWithAnd')
->willReturn('pseudo=filter');
- $access->userManager = $this->createMock(Manager::class);
+
+ $access->userManager->expects($this->any())
+ ->method('getAttributes')
+ ->willReturn(['displayName', 'mail']);
$groupBackend = new GroupLDAP($access, $pluginManager);
$users = $groupBackend->usersInGroup('foobar');
@@ -587,7 +598,10 @@ class Group_LDAPTest extends TestCase {
$access->expects($this->any())
->method('combineFilterWithAnd')
->willReturn('pseudo=filter');
- $access->userManager = $this->createMock(Manager::class);
+
+ $access->userManager->expects($this->any())
+ ->method('getAttributes')
+ ->willReturn(['displayName', 'mail']);
$groupBackend = new GroupLDAP($access, $pluginManager);
$users = $groupBackend->usersInGroup('foobar');
@@ -627,6 +641,10 @@ class Group_LDAPTest extends TestCase {
->method('isDNPartOfBase')
->willReturn(true);
+ $access->userManager->expects($this->any())
+ ->method('getAttributes')
+ ->willReturn(['displayName', 'mail']);
+
$groupBackend = new GroupLDAP($access, $pluginManager);
$users = $groupBackend->countUsersInGroup('foobar');