mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-05-30 20:51:57 +08:00
Fixed LDAP error thrown by not found user details
- Added testing to cover. Related to #1876
This commit is contained in:
@ -166,7 +166,7 @@ class LdapTest extends BrowserKitTest
|
||||
->seeInDatabase('users', ['email' => $this->mockUser->email, 'email_confirmed' => false, 'external_auth_id' => 'cooluser456']);
|
||||
}
|
||||
|
||||
public function test_initial_incorrect_details()
|
||||
public function test_initial_incorrect_credentials()
|
||||
{
|
||||
$this->mockLdap->shouldReceive('connect')->once()->andReturn($this->resourceId);
|
||||
$this->mockLdap->shouldReceive('setVersion')->once();
|
||||
@ -186,6 +186,23 @@ class LdapTest extends BrowserKitTest
|
||||
->dontSeeInDatabase('users', ['external_auth_id' => $this->mockUser->name]);
|
||||
}
|
||||
|
||||
public function test_login_not_found_username()
|
||||
{
|
||||
$this->mockLdap->shouldReceive('connect')->once()->andReturn($this->resourceId);
|
||||
$this->mockLdap->shouldReceive('setVersion')->once();
|
||||
$this->mockLdap->shouldReceive('setOption')->times(1);
|
||||
$this->mockLdap->shouldReceive('searchAndGetEntries')->times(1)
|
||||
->with($this->resourceId, config('services.ldap.base_dn'), \Mockery::type('string'), \Mockery::type('array'))
|
||||
->andReturn(['count' => 0]);
|
||||
$this->mockLdap->shouldReceive('bind')->times(1)->andReturn(true, false);
|
||||
$this->mockEscapes(1);
|
||||
|
||||
$this->mockUserLogin()
|
||||
->seePageIs('/login')->see('These credentials do not match our records.')
|
||||
->dontSeeInDatabase('users', ['external_auth_id' => $this->mockUser->name]);
|
||||
}
|
||||
|
||||
|
||||
public function test_create_user_form()
|
||||
{
|
||||
$this->asAdmin()->visit('/settings/users/create')
|
||||
|
Reference in New Issue
Block a user