diff options
author | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2020-06-24 23:34:37 +0200 |
---|---|---|
committer | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2020-06-24 23:34:37 +0200 |
commit | b8bef4ded07f1b7197437f9914ace4d2763e1b9f (patch) | |
tree | 161789f9af3affb5ace9e366f80c8c5deb59c2fe /apps/user_ldap/tests | |
parent | 7d4682da4008300c01f5745b438811032317e4c1 (diff) | |
download | nextcloud-server-b8bef4ded07f1b7197437f9914ace4d2763e1b9f.tar.gz nextcloud-server-b8bef4ded07f1b7197437f9914ace4d2763e1b9f.zip |
fix strings being passed where arrays where expected
also brought type hints up to internal API level
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 | 6 | ||||
-rw-r--r-- | apps/user_ldap/tests/Jobs/SyncTest.php | 14 | ||||
-rw-r--r-- | apps/user_ldap/tests/User_LDAPTest.php | 18 |
3 files changed, 38 insertions, 0 deletions
diff --git a/apps/user_ldap/tests/Group_LDAPTest.php b/apps/user_ldap/tests/Group_LDAPTest.php index 6a64a37f8c2..60b8b06b3cf 100644 --- a/apps/user_ldap/tests/Group_LDAPTest.php +++ b/apps/user_ldap/tests/Group_LDAPTest.php @@ -538,6 +538,9 @@ class Group_LDAPTest extends TestCase { $access->expects($this->any()) ->method('isDNPartOfBase') ->willReturn(true); + $access->expects($this->any()) + ->method('combineFilterWithAnd') + ->willReturn('pseudo=filter'); $access->userManager = $this->createMock(Manager::class); $groupBackend = new GroupLDAP($access, $pluginManager); @@ -576,6 +579,9 @@ class Group_LDAPTest extends TestCase { $access->expects($this->any()) ->method('isDNPartOfBase') ->willReturn(true); + $access->expects($this->any()) + ->method('combineFilterWithAnd') + ->willReturn('pseudo=filter'); $access->userManager = $this->createMock(Manager::class); $groupBackend = new GroupLDAP($access, $pluginManager); diff --git a/apps/user_ldap/tests/Jobs/SyncTest.php b/apps/user_ldap/tests/Jobs/SyncTest.php index 5f2adbe7dd1..0971e31ae85 100644 --- a/apps/user_ldap/tests/Jobs/SyncTest.php +++ b/apps/user_ldap/tests/Jobs/SyncTest.php @@ -189,9 +189,16 @@ class SyncTest extends TestCase { ->with($connection) ->willReturn($access); + $this->userManager->expects($this->any()) + ->method('getAttributes') + ->willReturn(['dn', 'uid', 'mail', 'displayname']); + $access->expects($this->once()) ->method('fetchListOfUsers') ->willReturn(array_pad([], $results, 'someUser')); + $access->expects($this->any()) + ->method('combineFilterWithAnd') + ->willReturn('pseudo=filter'); $access->connection = $connection; $access->userManager = $this->userManager; @@ -356,9 +363,16 @@ class SyncTest extends TestCase { ->with($connection) ->willReturn($access); + $this->userManager->expects($this->any()) + ->method('getAttributes') + ->willReturn(['dn', 'uid', 'mail', 'displayname']); + $access->expects($this->once()) ->method('fetchListOfUsers') ->willReturn(array_pad([], $runData['usersThisCycle'], 'someUser')); + $access->expects($this->any()) + ->method('combineFilterWithAnd') + ->willReturn('pseudo=filter'); $access->connection = $connection; $access->userManager = $this->userManager; diff --git a/apps/user_ldap/tests/User_LDAPTest.php b/apps/user_ldap/tests/User_LDAPTest.php index 00ca6737175..bfdaa99ac00 100644 --- a/apps/user_ldap/tests/User_LDAPTest.php +++ b/apps/user_ldap/tests/User_LDAPTest.php @@ -183,6 +183,10 @@ class User_LDAPTest extends TestCase { } return false; }); + + $this->userManager->expects($this->any()) + ->method('getAttributes') + ->willReturn(['dn', 'uid', 'mail', 'displayname']); } public function testCheckPasswordUidReturn() { @@ -400,6 +404,10 @@ class User_LDAPTest extends TestCase { ->willReturnArgument(0); $this->access->method('fetchUsersByLoginName') ->willReturn([]); + + $this->access->userManager->expects($this->any()) + ->method('getAttributes') + ->willReturn(['dn', 'uid', 'mail', 'displayname']); } public function testGetUsersNoParam() { @@ -1065,6 +1073,9 @@ class User_LDAPTest extends TestCase { ->method('get') ->with($dn) ->willReturn($user); + $this->userManager->expects($this->any()) + ->method('getAttributes') + ->willReturn(['dn', 'uid', 'mail', 'displayname']); $name = $backend->loginName2UserName($loginName); $this->assertSame($username, $name); @@ -1093,6 +1104,10 @@ class User_LDAPTest extends TestCase { ->method('writeToCache') ->with($this->equalTo('loginName2UserName-'.$loginName), false); + $this->userManager->expects($this->any()) + ->method('getAttributes') + ->willReturn(['dn', 'uid', 'mail', 'displayname']); + $backend = new UserLDAP($this->access, $this->config, $this->notificationManager, $this->session, $this->pluginManager); $name = $backend->loginName2UserName($loginName); $this->assertSame(false, $name); @@ -1126,6 +1141,9 @@ class User_LDAPTest extends TestCase { ->method('get') ->with($dn) ->willReturn($offlineUser); + $this->userManager->expects($this->any()) + ->method('getAttributes') + ->willReturn(['dn', 'uid', 'mail', 'displayname']); $backend = new UserLDAP($this->access, $this->config, $this->notificationManager, $this->session, $this->pluginManager); $name = $backend->loginName2UserName($loginName); |