-
Notifications
You must be signed in to change notification settings - Fork 302
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move config option to Fortify feature
- Loading branch information
1 parent
91278c5
commit d74919c
Showing
5 changed files
with
30 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,13 +13,12 @@ | |
use PragmaRX\Google2FA\Google2FA; | ||
|
||
#[WithMigration] | ||
#[DefineEnvironment('withTwoFactorAuthentication')] | ||
#[WithConfig('auth.providers.users.model', UserWithTwoFactor::class)] | ||
#[WithConfig('fortify.enforce_two_factor_auth', true)] | ||
class AuthenticatedSessionControllerWithEnforcedTwoFactorTest extends OrchestraTestCase | ||
{ | ||
use RefreshDatabase; | ||
|
||
#[DefineEnvironment('withConfirmedEnforcedTwoFactorAuthentication')] | ||
public function test_user_is_redirected_to_setup_page_when_two_factor_is_enforced() | ||
{ | ||
Event::fake(); | ||
|
@@ -40,6 +39,7 @@ public function test_user_is_redirected_to_setup_page_when_two_factor_is_enforce | |
Event::assertDispatched(TwoFactorAuthenticationSetupRequired::class); | ||
} | ||
|
||
#[DefineEnvironment('withConfirmedEnforcedTwoFactorAuthentication')] | ||
public function test_json_response_contains_data_required_for_setting_up_two_factor_when_enforced() | ||
{ | ||
Event::fake(); | ||
|
@@ -68,6 +68,7 @@ public function test_json_response_contains_data_required_for_setting_up_two_fac | |
]); | ||
} | ||
|
||
#[DefineEnvironment('withConfirmedEnforcedTwoFactorAuthentication')] | ||
public function test_user_is_redirected_to_challenge_when_two_factor_is_already_setup() | ||
{ | ||
Event::fake(); | ||
|
@@ -77,6 +78,7 @@ public function test_user_is_redirected_to_challenge_when_two_factor_is_already_ | |
'email' => '[email protected]', | ||
'password' => bcrypt('secret'), | ||
'two_factor_secret' => 'test-secret', | ||
'two_factor_confirmed_at' => now(), | ||
]); | ||
|
||
$response = $this->withoutExceptionHandling()->post('/login', [ | ||
|
@@ -89,7 +91,7 @@ public function test_user_is_redirected_to_challenge_when_two_factor_is_already_ | |
$response->assertRedirect('/two-factor-challenge'); | ||
} | ||
|
||
#[DefineEnvironment('withConfirmedTwoFactorAuthentication')] | ||
#[DefineEnvironment('withConfirmedEnforcedTwoFactorAuthentication')] | ||
public function test_two_factor_is_confirmed_when_feature_enabled_after_successful_setup() | ||
{ | ||
Event::fake(); | ||
|
@@ -120,7 +122,7 @@ public function test_two_factor_is_confirmed_when_feature_enabled_after_successf | |
$this->assertNotNull($user->two_factor_confirmed_at); | ||
} | ||
|
||
#[DefineEnvironment('withConfirmedTwoFactorAuthentication')] | ||
#[DefineEnvironment('withConfirmedEnforcedTwoFactorAuthentication')] | ||
public function test_user_is_redirected_to_home_when_two_factor_is_successfully_set_up() | ||
{ | ||
Event::fake(); | ||
|
@@ -150,7 +152,7 @@ public function test_user_is_redirected_to_home_when_two_factor_is_successfully_ | |
->assertSessionMissing('login.id'); | ||
} | ||
|
||
#[DefineEnvironment('withConfirmedTwoFactorAuthentication')] | ||
#[DefineEnvironment('withConfirmedEnforcedTwoFactorAuthentication')] | ||
public function test_setup_fails_if_confirm_two_factor_is_enabled_and_code_is_incorrect() | ||
{ | ||
Event::fake(); | ||
|
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