Skip to content

Commit

Permalink
Skip DeleteAccountTest if feature is not enabled (#641)
Browse files Browse the repository at this point in the history
* Skip DeleteAccountTest if feature is not enabled

* Update DeleteAccountTest.php

* Update DeleteAccountTest.php

Co-authored-by: Taylor Otwell <taylor@laravel.com>
  • Loading branch information
arubacao and taylorotwell committed Jan 18, 2021
1 parent f2c93d6 commit 56271e6
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
9 changes: 9 additions & 0 deletions stubs/tests/inertia/DeleteAccountTest.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\Jetstream\Features;
use Tests\TestCase;

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

public function test_user_accounts_can_be_deleted()
{
if (! Features::hasAccountDeletionFeatures()) {
return $this->markTestSkipped('Account deletion is not enabled.');
}

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

$response = $this->delete('/user', [
Expand All @@ -23,6 +28,10 @@ public function test_user_accounts_can_be_deleted()

public function test_correct_password_must_be_provided_before_account_can_be_deleted()
{
if (! Features::hasAccountDeletionFeatures()) {
return $this->markTestSkipped('Account deletion is not enabled.');
}

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

$response = $this->delete('/user', [
Expand Down
9 changes: 9 additions & 0 deletions stubs/tests/livewire/DeleteAccountTest.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\Jetstream\Features;
use Laravel\Jetstream\Http\Livewire\DeleteUserForm;
use Livewire\Livewire;
use Tests\TestCase;
Expand All @@ -14,6 +15,10 @@ class DeleteAccountTest extends TestCase

public function test_user_accounts_can_be_deleted()
{
if (! Features::hasAccountDeletionFeatures()) {
return $this->markTestSkipped('Account deletion is not enabled.');
}

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

$component = Livewire::test(DeleteUserForm::class)
Expand All @@ -25,6 +30,10 @@ public function test_user_accounts_can_be_deleted()

public function test_correct_password_must_be_provided_before_account_can_be_deleted()
{
if (! Features::hasAccountDeletionFeatures()) {
return $this->markTestSkipped('Account deletion is not enabled.');
}

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

Livewire::test(DeleteUserForm::class)
Expand Down

0 comments on commit 56271e6

Please sign in to comment.