@@ -11,6 +11,7 @@ class LdapTest extends BrowserKitTest
1111 public function setUp ()
1212 {
1313 parent ::setUp ();
14+ if (!defined ('LDAP_OPT_REFERRALS ' )) define ('LDAP_OPT_REFERRALS ' , 1 );
1415 app ('config ' )->set (['auth.method ' => 'ldap ' , 'services.ldap.base_dn ' => 'dc=ldap,dc=local ' , 'auth.providers.users.driver ' => 'ldap ' ]);
1516 $ this ->mockLdap = \Mockery::mock (\BookStack \Services \Ldap::class);
1617 $ this ->app ['BookStack\Services\Ldap ' ] = $ this ->mockLdap ;
@@ -21,6 +22,7 @@ public function test_login()
2122 {
2223 $ this ->mockLdap ->shouldReceive ('connect ' )->once ()->andReturn ($ this ->resourceId );
2324 $ this ->mockLdap ->shouldReceive ('setVersion ' )->once ();
25+ $ this ->mockLdap ->shouldReceive ('setOption ' )->times (4 );
2426 $ this ->mockLdap ->shouldReceive ('searchAndGetEntries ' )->times (4 )
2527 ->with ($ this ->resourceId , config ('services.ldap.base_dn ' ), \Mockery::type ('string ' ), \Mockery::type ('array ' ))
2628 ->andReturn (['count ' => 1 , 0 => [
@@ -49,6 +51,7 @@ public function test_login_works_when_no_uid_provided_by_ldap_server()
4951 $ this ->mockLdap ->shouldReceive ('connect ' )->once ()->andReturn ($ this ->resourceId );
5052 $ this ->mockLdap ->shouldReceive ('setVersion ' )->once ();
5153 $ ldapDn = 'cn=test-user,dc=test ' . config ('services.ldap.base_dn ' );
54+ $ this ->mockLdap ->shouldReceive ('setOption ' )->times (2 );
5255 $ this ->mockLdap ->shouldReceive ('searchAndGetEntries ' )->times (2 )
5356 ->with ($ this ->resourceId , config ('services.ldap.base_dn ' ), \Mockery::type ('string ' ), \Mockery::type ('array ' ))
5457 ->andReturn (['count ' => 1 , 0 => [
@@ -72,6 +75,7 @@ public function test_initial_incorrect_details()
7275 {
7376 $ this ->mockLdap ->shouldReceive ('connect ' )->once ()->andReturn ($ this ->resourceId );
7477 $ this ->mockLdap ->shouldReceive ('setVersion ' )->once ();
78+ $ this ->mockLdap ->shouldReceive ('setOption ' )->times (2 );
7579 $ this ->mockLdap ->shouldReceive ('searchAndGetEntries ' )->times (2 )
7680 ->with ($ this ->resourceId , config ('services.ldap.base_dn ' ), \Mockery::type ('string ' ), \Mockery::type ('array ' ))
7781 ->andReturn (['count ' => 1 , 0 => [
0 commit comments