-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
81 additions
and
14 deletions.
There are no files selected for viewing
Binary file not shown.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<?php | ||
|
||
use App\Models\User; | ||
use Illuminate\Support\Facades\Auth; | ||
use Illuminate\Support\Facades\Hash; | ||
|
||
beforeEach(function () { | ||
// Ensure each test starts with a clean slate | ||
User::query()->delete(); | ||
}); | ||
|
||
test('Two factor challenge page redirects to login for guest user', function(){ | ||
$this->get('auth/two-factor-challenge') | ||
->assertRedirect('auth/login'); | ||
}); | ||
|
||
test('Two factor challenge page redirects if user is logged in and they don\'t have the login.id session', function(){ | ||
withANewUser()->get('auth/two-factor-challenge') | ||
->assertRedirect('auth/login'); | ||
}); | ||
|
||
test('when user logs in and two factor auth is active, they will have the login.id session created', function(){ | ||
$user = User::factory()->create(['name' => 'Homer Simpson', 'email' => '[email protected]', 'password' => \Hash::make('DuffBeer123')]); | ||
// $this->get('auth/login') | ||
// ->seeInField('email', '[email protected]') | ||
// ->click('.auth-component-button') | ||
// ->assertSee('Password'); | ||
// dd($user->two_factor_secret); | ||
//dd(\Schema::getColumnListing('users')); | ||
//dd(env('DB_CONNECTION')); | ||
//dd($user); | ||
})->todo(); | ||
|
||
it('user can view two factor challenge page after they login', function(){ | ||
|
||
// Livewire::test('auth.register') | ||
// ->set('email', '[email protected]') | ||
// ->set('password', 'secret1234') | ||
// ->set('name', 'John Doe') | ||
// ->call('register') | ||
|
||
withANewUser()->get('auth/two-factor-challenge')->asertOK(); | ||
// $user = loginAsUser(null); | ||
// Livewire::test('auth.two-factor-challenge'); | ||
// ->assertSee('When you enabled 2FA'); | ||
})->todo(); | ||
|
||
test('when authenticated, user can view /user/two-factor-authentication page', function(){ | ||
|
||
})->todo(); | ||
|
||
test('when authenticated, user can view /user/two-factor-authentication page and they can click enable and add auth code', function(){ | ||
|
||
})->todo(); | ||
|
||
// scenarios when 2FA is disabled by application admin | ||
test('if two factor auth is disabled, user can login with name and password and they will not be redirected to 2fa page, even if they have the correct two_factor table columns filled', function(){ | ||
|
||
})->todo(); |
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 |
---|---|---|
@@ -1,17 +1,5 @@ | ||
<?php | ||
|
||
// uses(\Illuminate\Support\Facades\Artisan::class); | ||
|
||
beforeAll(function () { | ||
// \Artisan::call('view:clear'); | ||
// echo 'what cool!'; | ||
}); | ||
|
||
// beforeEach(function () { | ||
// echo 'ww'; | ||
// }); | ||
|
||
|
||
test('that authentication URLs return a 200', function ($url) { | ||
$this->get($url)->assertOK(); | ||
})->with('urls'); |
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