diff --git a/stubs/pest-tests/inertia/TwoFactorAuthenticationSettingsTest.php b/stubs/pest-tests/inertia/TwoFactorAuthenticationSettingsTest.php index fdcacf87a..371f63396 100644 --- a/stubs/pest-tests/inertia/TwoFactorAuthenticationSettingsTest.php +++ b/stubs/pest-tests/inertia/TwoFactorAuthenticationSettingsTest.php @@ -1,6 +1,7 @@ actingAs($user = User::factory()->create()); @@ -11,7 +12,9 @@ expect($user->fresh()->two_factor_secret)->not->toBeNull(); expect($user->fresh()->recoveryCodes())->toHaveCount(8); -}); +})->skip(function () { + return ! Features::canManageTwoFactorAuthentication(); +}, 'Two factor authentication is not enabled.'); test('recovery codes can be regenerated', function () { $this->actingAs($user = User::factory()->create()); @@ -27,7 +30,9 @@ expect($user->recoveryCodes())->toHaveCount(8); expect(array_diff($user->recoveryCodes(), $user->fresh()->recoveryCodes()))->toHaveCount(8); -}); +})->skip(function () { + return ! Features::canManageTwoFactorAuthentication(); +}, 'Two factor authentication is not enabled.'); test('two factor authentication can be disabled', function () { $this->actingAs($user = User::factory()->create()); @@ -41,4 +46,6 @@ $this->delete('/user/two-factor-authentication'); expect($user->fresh()->two_factor_secret)->toBeNull(); -}); +})->skip(function () { + return ! Features::canManageTwoFactorAuthentication(); +}, 'Two factor authentication is not enabled.'); diff --git a/stubs/pest-tests/livewire/TwoFactorAuthenticationSettingsTest.php b/stubs/pest-tests/livewire/TwoFactorAuthenticationSettingsTest.php index c5309272e..cd767fde4 100644 --- a/stubs/pest-tests/livewire/TwoFactorAuthenticationSettingsTest.php +++ b/stubs/pest-tests/livewire/TwoFactorAuthenticationSettingsTest.php @@ -1,6 +1,7 @@ two_factor_secret)->not->toBeNull(); expect($user->recoveryCodes())->toHaveCount(8); -}); +})->skip(function () { + return ! Features::canManageTwoFactorAuthentication(); +}, 'Two factor authentication is not enabled.'); test('recovery codes can be regenerated', function () { $this->actingAs($user = User::factory()->create()); @@ -33,7 +36,9 @@ expect($user->recoveryCodes())->toHaveCount(8); expect(array_diff($user->recoveryCodes(), $user->fresh()->recoveryCodes()))->toHaveCount(8); -}); +})->skip(function () { + return ! Features::canManageTwoFactorAuthentication(); +}, 'Two factor authentication is not enabled.'); test('two factor authentication can be disabled', function () { $this->actingAs($user = User::factory()->create()); @@ -48,4 +53,6 @@ $component->call('disableTwoFactorAuthentication'); expect($user->fresh()->two_factor_secret)->toBeNull(); -}); +})->skip(function () { + return ! Features::canManageTwoFactorAuthentication(); +}, 'Two factor authentication is not enabled.'); diff --git a/stubs/tests/inertia/TwoFactorAuthenticationSettingsTest.php b/stubs/tests/inertia/TwoFactorAuthenticationSettingsTest.php index ab68458b0..6a0eaf405 100644 --- a/stubs/tests/inertia/TwoFactorAuthenticationSettingsTest.php +++ b/stubs/tests/inertia/TwoFactorAuthenticationSettingsTest.php @@ -4,6 +4,7 @@ use App\Models\User; use Illuminate\Foundation\Testing\RefreshDatabase; +use Laravel\Fortify\Features; use Tests\TestCase; class TwoFactorAuthenticationSettingsTest extends TestCase @@ -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()]); @@ -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()]); @@ -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()]); diff --git a/stubs/tests/livewire/TwoFactorAuthenticationSettingsTest.php b/stubs/tests/livewire/TwoFactorAuthenticationSettingsTest.php index 60dc0dbc4..fa2ddd57b 100644 --- a/stubs/tests/livewire/TwoFactorAuthenticationSettingsTest.php +++ b/stubs/tests/livewire/TwoFactorAuthenticationSettingsTest.php @@ -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; @@ -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()]); @@ -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()]); @@ -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()]);