]> BookStack Code Mirror - bookstack/blobdiff - tests/Auth/LdapTest.php
Updated attachment links to have dropdown for open type
[bookstack] / tests / Auth / LdapTest.php
index c59685ef5daadd422ab7d22252092517a3b3ee1a..96e10e4dae818a7155306c55f050c875b9d7596d 100644 (file)
@@ -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', [