Laravel Jetstream install

This commit is contained in:
Benjamin Takats
2022-11-29 17:42:58 +01:00
parent 17cfffc817
commit 9e56453d46
127 changed files with 5887 additions and 197 deletions

View File

@@ -0,0 +1,45 @@
<?php
namespace Tests\Feature;
use App\Models\Team;
use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Laravel\Jetstream\Http\Livewire\DeleteTeamForm;
use Livewire\Livewire;
use Tests\TestCase;
class DeleteTeamTest extends TestCase
{
use RefreshDatabase;
public function test_teams_can_be_deleted()
{
$this->actingAs($user = User::factory()->withPersonalTeam()->create());
$user->ownedTeams()->save($team = Team::factory()->make([
'personal_team' => false,
]));
$team->users()->attach(
$otherUser = User::factory()->create(), ['role' => 'test-role']
);
$component = Livewire::test(DeleteTeamForm::class, ['team' => $team->fresh()])
->call('deleteTeam');
$this->assertNull($team->fresh());
$this->assertCount(0, $otherUser->fresh()->teams);
}
public function test_personal_teams_cant_be_deleted()
{
$this->actingAs($user = User::factory()->withPersonalTeam()->create());
$component = Livewire::test(DeleteTeamForm::class, ['team' => $user->currentTeam])
->call('deleteTeam')
->assertHasErrors(['team']);
$this->assertNotNull($user->currentTeam->fresh());
}
}