diff options
author | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2019-05-23 16:58:58 +0200 |
---|---|---|
committer | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2019-05-27 12:03:05 +0200 |
commit | c6c8a41d2f34a05dbb8b24b280c767b022a3c338 (patch) | |
tree | 45852452a236211e8126fce4557baa4aa435f0d2 /apps/user_ldap/tests | |
parent | 96e892770d0b37fab66f8b92c10866fadccf98c5 (diff) | |
download | nextcloud-server-c6c8a41d2f34a05dbb8b24b280c767b022a3c338.tar.gz nextcloud-server-c6c8a41d2f34a05dbb8b24b280c767b022a3c338.zip |
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.php | 39 |
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)); + } + } |