Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@arthur-schiwon.de>2019-05-23 17:58:58 +0300
committerArthur Schiwon <blizzz@arthur-schiwon.de>2019-05-27 13:03:05 +0300
commitc6c8a41d2f34a05dbb8b24b280c767b022a3c338 (patch)
tree45852452a236211e8126fce4557baa4aa435f0d2 /apps/user_ldap/tests
parent96e892770d0b37fab66f8b92c10866fadccf98c5 (diff)
group display name support (service level + ldap)
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.php39
1 files changed, 39 insertions, 0 deletions
diff --git a/apps/user_ldap/tests/Group_LDAPTest.php b/apps/user_ldap/tests/Group_LDAPTest.php
index cb5760e3171..a505c403acb 100644
--- a/apps/user_ldap/tests/Group_LDAPTest.php
+++ b/apps/user_ldap/tests/Group_LDAPTest.php
@@ -1057,4 +1057,43 @@ class Group_LDAPTest extends TestCase {
$this->assertEquals($expectedMembers, $resultingMembers, '', 0.0, 10, true);
}
+ public function displayNameProvider() {
+ return [
+ ['Graphic Novelists', ['Graphic Novelists']],
+ ['', false],
+ ];
+ }
+
+ /**
+ * @dataProvider displayNameProvider
+ */
+ public function testGetDisplayName(string $expected, $ldapResult) {
+ $gid = 'graphic_novelists';
+
+ $access = $this->getAccessMock();
+ $access->expects($this->atLeastOnce())
+ ->method('readAttribute')
+ ->willReturn($ldapResult);
+
+ $access->connection = $this->createMock(Connection::class);
+ $access->connection->expects($this->any())
+ ->method('__get')
+ ->willReturnCallback(function($name) {
+ if($name === 'ldapGroupMemberAssocAttr') {
+ return 'member';
+ } else if($name === 'ldapGroupFilter') {
+ return 'objectclass=nextcloudGroup';
+ } else if($name === 'ldapGroupDisplayName') {
+ return 'cn';
+ }
+ return null;
+ });
+
+ /** @var GroupPluginManager $pluginManager */
+ $pluginManager = $this->createMock(GroupPluginManager::class);
+
+ $ldap = new GroupLDAP($access, $pluginManager);
+ $this->assertSame($expected, $ldap->getDisplayName($gid));
+ }
+
}