Skip to content
This repository was archived by the owner on Jul 24, 2023. It is now read-only.

Commit e5257bd

Browse files
committed
Update tests
1 parent b6ad8a7 commit e5257bd

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

tests/AdldapTest.php

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,17 @@
1010

1111
class AdldapTest extends FunctionalTestCase
1212
{
13+
public function setUp()
14+
{
15+
parent::setUp();
16+
17+
// Set auth configuration for email use since stock
18+
// laravel only comes with an email field
19+
$this->app['config']->set('adldap_auth.username_attribute', [
20+
'email' => 'mail',
21+
]);
22+
}
23+
1324
public function testConfigurationNotFoundException()
1425
{
1526
$this->app['config']->set('adldap', null);
@@ -59,7 +70,7 @@ public function testAuthPasses()
5970
Adldap::shouldReceive('users')->once()->andReturn($mockedUsers);
6071
Adldap::shouldReceive('authenticate')->once()->andReturn(true);
6172

62-
$this->assertTrue(Auth::attempt(['username' => 'jdoe', 'password' => '12345']));
73+
$this->assertTrue(Auth::attempt(['email' => 'jdoe@email.com', 'password' => '12345']));
6374

6475
$user = Auth::user();
6576

@@ -100,7 +111,7 @@ public function testAuthFails()
100111

101112
Adldap::shouldReceive('users')->once()->andReturn($mockedUsers);
102113

103-
$this->assertFalse(Auth::attempt(['username' => 'jdoe', 'password' => '12345']));
114+
$this->assertFalse(Auth::attempt(['email' => 'jdoe', 'password' => '12345']));
104115
}
105116

106117
public function testAuthFailsWhenUserFound()
@@ -127,7 +138,7 @@ public function testAuthFailsWhenUserFound()
127138
Adldap::shouldReceive('users')->once()->andReturn($mockedUsers);
128139
Adldap::shouldReceive('authenticate')->once()->andReturn(false);
129140

130-
$this->assertFalse(Auth::attempt(['username' => 'jdoe', 'password' => '12345']));
141+
$this->assertFalse(Auth::attempt(['email' => 'jdoe', 'password' => '12345']));
131142
}
132143

133144
public function testCredentialsKeyDoesNotExist()

0 commit comments

Comments
 (0)