X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/8594f4258417e0e7a4a59c17d006d87dc84e9f3a..refs/pull/3433/head:/tests/Auth/LdapTest.php diff --git a/tests/Auth/LdapTest.php b/tests/Auth/LdapTest.php index c59685ef5..96e10e4da 100644 --- a/tests/Auth/LdapTest.php +++ b/tests/Auth/LdapTest.php @@ -367,7 +367,7 @@ class LdapTest extends TestCase $this->mockLdap->shouldReceive('searchAndGetEntries')->times(4) ->with($this->resourceId, config('services.ldap.base_dn'), \Mockery::type('string'), \Mockery::type('array')) ->andReturn($userResp, ['count' => 1, - 0 => [ + 0 => [ 'dn' => 'dc=test,' . config('services.ldap.base_dn'), 'memberof' => [ 'count' => 1, @@ -376,13 +376,13 @@ class LdapTest extends TestCase ], ], [ 'count' => 1, - 0 => [ - 'dn' => 'cn=ldaptester,ou=groups,dc=example,dc=com', + 0 => [ + 'dn' => 'cn=ldaptester,ou=groups,dc=example,dc=com', 'memberof' => [ 'count' => 1, 0 => 'cn=monsters,ou=groups,dc=example,dc=com', ], - ] + ], ], ['count' => 0]); $resp = $this->mockUserLogin(); @@ -390,9 +390,9 @@ class LdapTest extends TestCase 'details_from_ldap' => [ 'dn' => 'dc=test,' . config('services.ldap.base_dn'), 'memberof' => [ - 0 => 'cn=ldaptester,ou=groups,dc=example,dc=com', + 0 => 'cn=ldaptester,ou=groups,dc=example,dc=com', 'count' => 1, - ] + ], ], 'parsed_direct_user_groups' => [ 'ldaptester', @@ -615,7 +615,7 @@ class LdapTest extends TestCase public function test_dump_user_details_option_works() { - config()->set(['services.ldap.dump_user_details' => true]); + config()->set(['services.ldap.dump_user_details' => true, 'services.ldap.thumbnail_attribute' => 'jpegphoto']); $this->commonLdapMocks(1, 1, 1, 1, 1); $this->mockLdap->shouldReceive('searchAndGetEntries')->times(1) @@ -623,7 +623,9 @@ class LdapTest extends TestCase ->andReturn(['count' => 1, 0 => [ 'uid' => [$this->mockUser->name], 'cn' => [$this->mockUser->name], - 'dn' => ['dc=test' . config('services.ldap.base_dn')], + // Test dumping binary data for avatar responses + 'jpegphoto' => base64_decode('/9j/4AAQSkZJRg=='), + 'dn' => ['dc=test' . config('services.ldap.base_dn')], ]]); $resp = $this->post('/login', [