forked from TheRestartProject/RepairDirectory
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixed login browser by creating own DuskServiceProvider
- Loading branch information
1 parent
b8bbe79
commit 80cfdd0
Showing
6 changed files
with
98 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
tests/Integration/Application/Auth/FixometerSessionGuardTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
<?php | ||
|
||
namespace TheRestartProject\RepairDirectory\Tests\Integration\Application\Auth; | ||
|
||
use Illuminate\Contracts\Auth\Authenticatable; | ||
use Illuminate\Support\Facades\Auth; | ||
use TheRestartProject\RepairDirectory\Application\Auth\FixometerSessionGuard; | ||
use TheRestartProject\RepairDirectory\Domain\Models\User; | ||
use TheRestartProject\RepairDirectory\Testing\DatabaseMigrations; | ||
use TheRestartProject\RepairDirectory\Tests\IntegrationTestCase; | ||
|
||
class FixometerSessionGuardTest extends IntegrationTestCase | ||
{ | ||
use DatabaseMigrations; | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function it_can_login_an_existing_user() | ||
{ | ||
/** | ||
* The Created user that implements Authenticable | ||
* | ||
* @var Authenticatable $user | ||
*/ | ||
$user = entity(User::class)->create(); | ||
|
||
$this->guard()->login($user); | ||
|
||
$this->assertLoggedInAs($user); | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function it_can_log_out_a_logged_in_user() | ||
{ | ||
/** | ||
* The Created user that implements Authenticable | ||
* | ||
* @var Authenticatable $user | ||
*/ | ||
$user = entity(User::class)->create(); | ||
|
||
$this->guard()->login($user); | ||
|
||
$this->assertLoggedInAs($user); | ||
} | ||
|
||
/** | ||
* @return FixometerSessionGuard | ||
*/ | ||
protected function guard() | ||
{ | ||
return $this->app->make('auth')->guard(); | ||
} | ||
|
||
/** | ||
* @param $user | ||
*/ | ||
protected function assertLoggedInAs($user) | ||
{ | ||
$loggedInUser = $this->guard()->user(); | ||
|
||
self::assertInstanceOf(Authenticatable::class, $loggedInUser); | ||
self::assertEquals($user->getAuthIdentifier(), $loggedInUser->getAuthIdentifier()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters