Skip to content

Modify two factor auth test #793

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions stubs/tests/inertia/TwoFactorAuthenticationSettingsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Laravel\Fortify\Features;
use Tests\TestCase;

class TwoFactorAuthenticationSettingsTest extends TestCase
Expand All @@ -12,6 +13,10 @@ class TwoFactorAuthenticationSettingsTest extends TestCase

public function test_two_factor_authentication_can_be_enabled()
{
if (! Features::canManageTwoFactorAuthentication()) {
return $this->markTestSkipped('Two factor authentication is not enabled.');
}

$this->actingAs($user = User::factory()->create());

$this->withSession(['auth.password_confirmed_at' => time()]);
Expand All @@ -24,6 +29,10 @@ public function test_two_factor_authentication_can_be_enabled()

public function test_recovery_codes_can_be_regenerated()
{
if (! Features::canManageTwoFactorAuthentication()) {
return $this->markTestSkipped('Two factor authentication is not enabled.');
}

$this->actingAs($user = User::factory()->create());

$this->withSession(['auth.password_confirmed_at' => time()]);
Expand All @@ -41,6 +50,10 @@ public function test_recovery_codes_can_be_regenerated()

public function test_two_factor_authentication_can_be_disabled()
{
if (! Features::canManageTwoFactorAuthentication()) {
return $this->markTestSkipped('Two factor authentication is not enabled.');
}

$this->actingAs($user = User::factory()->create());

$this->withSession(['auth.password_confirmed_at' => time()]);
Expand Down
13 changes: 13 additions & 0 deletions stubs/tests/livewire/TwoFactorAuthenticationSettingsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Laravel\Fortify\Features;
use Laravel\Jetstream\Http\Livewire\TwoFactorAuthenticationForm;
use Livewire\Livewire;
use Tests\TestCase;
Expand All @@ -14,6 +15,10 @@ class TwoFactorAuthenticationSettingsTest extends TestCase

public function test_two_factor_authentication_can_be_enabled()
{
if (! Features::canManageTwoFactorAuthentication()) {
return $this->markTestSkipped('Two factor authentication is not enabled.');
}

$this->actingAs($user = User::factory()->create());

$this->withSession(['auth.password_confirmed_at' => time()]);
Expand All @@ -29,6 +34,10 @@ public function test_two_factor_authentication_can_be_enabled()

public function test_recovery_codes_can_be_regenerated()
{
if (! Features::canManageTwoFactorAuthentication()) {
return $this->markTestSkipped('Two factor authentication is not enabled.');
}

$this->actingAs($user = User::factory()->create());

$this->withSession(['auth.password_confirmed_at' => time()]);
Expand All @@ -47,6 +56,10 @@ public function test_recovery_codes_can_be_regenerated()

public function test_two_factor_authentication_can_be_disabled()
{
if (! Features::canManageTwoFactorAuthentication()) {
return $this->markTestSkipped('Two factor authentication is not enabled.');
}

$this->actingAs($user = User::factory()->create());

$this->withSession(['auth.password_confirmed_at' => time()]);
Expand Down