diff options
Diffstat (limited to 'apps/user_ldap/tests/AccessTest.php')
-rw-r--r-- | apps/user_ldap/tests/AccessTest.php | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/apps/user_ldap/tests/AccessTest.php b/apps/user_ldap/tests/AccessTest.php index 73fd35b8960..5aec76eb385 100644 --- a/apps/user_ldap/tests/AccessTest.php +++ b/apps/user_ldap/tests/AccessTest.php @@ -442,7 +442,7 @@ class AccessTest extends TestCase { $this->assertSame($values[0], strtolower($dnFromServer)); } - + public function testSetPasswordWithDisabledChanges() { $this->expectException(\Exception::class); $this->expectExceptionMessage('LDAP password changes are disabled'); @@ -474,7 +474,7 @@ class AccessTest extends TestCase { $this->assertFalse($this->access->setPassword('CN=foo', 'MyPassword')); } - + public function testSetPasswordWithRejectedChange() { $this->expectException(\OC\HintException::class); $this->expectExceptionMessage('Password change rejected.'); @@ -540,7 +540,7 @@ class AccessTest extends TestCase { ->method('__get') ->willReturnCallback(function ($key) use ($base) { if (stripos($key, 'base') !== false) { - return $base; + return [$base]; } return null; }); @@ -548,8 +548,8 @@ class AccessTest extends TestCase { $this->ldap ->expects($this->any()) ->method('isResource') - ->willReturnCallback(function ($resource) use ($fakeConnection) { - return $resource === $fakeConnection; + ->willReturnCallback(function ($resource) { + return is_resource($resource); }); $this->ldap ->expects($this->any()) @@ -558,9 +558,9 @@ class AccessTest extends TestCase { $this->ldap ->expects($this->once()) ->method('search') - ->willReturn([$fakeSearchResultResource]); + ->willReturn($fakeSearchResultResource); $this->ldap - ->expects($this->exactly(count($base))) + ->expects($this->exactly(1)) ->method('getEntries') ->willReturn($fakeLdapEntries); @@ -572,17 +572,17 @@ class AccessTest extends TestCase { public function testSearchNoPagedSearch() { // scenario: no pages search, 1 search base $filter = 'objectClass=nextcloudUser'; - $base = ['ou=zombies,dc=foobar,dc=nextcloud,dc=com']; + $base = 'ou=zombies,dc=foobar,dc=nextcloud,dc=com'; - $fakeConnection = new \stdClass(); - $fakeSearchResultResource = new \stdClass(); + $fakeConnection = ldap_connect(); + $fakeSearchResultResource = ldap_connect(); $fakeLdapEntries = [ 'count' => 2, [ - 'dn' => 'uid=sgarth,' . $base[0], + 'dn' => 'uid=sgarth,' . $base, ], [ - 'dn' => 'uid=wwilson,' . $base[0], + 'dn' => 'uid=wwilson,' . $base, ] ]; @@ -598,19 +598,19 @@ class AccessTest extends TestCase { public function testFetchListOfUsers() { $filter = 'objectClass=nextcloudUser'; - $base = ['ou=zombies,dc=foobar,dc=nextcloud,dc=com']; + $base = 'ou=zombies,dc=foobar,dc=nextcloud,dc=com'; $attrs = ['dn', 'uid']; - $fakeConnection = new \stdClass(); - $fakeSearchResultResource = new \stdClass(); + $fakeConnection = ldap_connect(); + $fakeSearchResultResource = ldap_connect(); $fakeLdapEntries = [ 'count' => 2, [ - 'dn' => 'uid=sgarth,' . $base[0], + 'dn' => 'uid=sgarth,' . $base, 'uid' => [ 'sgarth' ], ], [ - 'dn' => 'uid=wwilson,' . $base[0], + 'dn' => 'uid=wwilson,' . $base, 'uid' => [ 'wwilson' ], ] ]; |