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

Commit 3bd1a43

Browse files
committed
Fix tests.
1 parent 277a855 commit 3bd1a43

File tree

1 file changed

+21
-5
lines changed

1 file changed

+21
-5
lines changed

tests/AdldapTest.php

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ public function test_config_callback_attribute_handler()
159159

160160
$this->test_auth_passes();
161161

162-
$user = \Auth::user();
162+
$user = Auth::user();
163163

164164
$this->assertEquals('handled', $user->name);
165165
}
@@ -257,9 +257,17 @@ public function test_config_password_sync_enabled()
257257

258258
$this->getMockAuth()->shouldReceive('attempt')->once()->andReturn(true);
259259

260-
$this->assertTrue(Auth::attempt(['email' => 'jdoe@email.com', 'password' => '12345']));
260+
$email = 'joe@email.com';
261+
$password = '12345';
262+
263+
$this->assertTrue(Auth::attempt(compact('email', 'password')));
264+
265+
$user = EloquentUser::first();
266+
267+
$this->assertInstanceOf(EloquentUser::class, $user);
261268

262-
$this->assertInstanceOf(EloquentUser::class, EloquentUser::first());
269+
// This check will pass due to password synchronization being enabled.
270+
$this->assertTrue(Hash::check($password, $user->password));
263271
}
264272

265273
public function test_config_password_sync_disabled()
@@ -268,9 +276,17 @@ public function test_config_password_sync_disabled()
268276

269277
$this->getMockAuth()->shouldReceive('attempt')->once()->andReturn(true);
270278

271-
$this->assertTrue(Auth::attempt(['email' => 'jdoe@email.com', 'password' => '12345']));
279+
$email = 'joe@email.com';
280+
$password = '12345';
281+
282+
$this->assertTrue(Auth::attempt(compact('email', 'password')));
283+
284+
$user = EloquentUser::first();
285+
286+
$this->assertInstanceOf(EloquentUser::class, $user);
272287

273-
$this->assertInstanceOf(EloquentUser::class, EloquentUser::first());
288+
// This check will fail due to password synchronization being disabled.
289+
$this->assertFalse(Hash::check($password, $user->password));
274290
}
275291

276292
protected function getMockAuth(User $user = null)

0 commit comments

Comments
 (0)