create(); $team = Team::factory()->create(); $user->teams()->attach($team, ['role' => $role]); $server = Server::factory()->create(['team_id' => $team->id]); $destination = $server->standaloneDockers()->firstOrFail(); $project = Project::factory()->create(['team_id' => $team->id]); $environment = Environment::factory()->create(['project_id' => $project->id]); test()->actingAs($user); session(['currentTeam' => $team]); return Application::factory()->create([ 'environment_id' => $environment->id, 'destination_id' => $destination->id, 'destination_type' => $destination->getMorphClass(), ]); } it('shows one red insufficient permissions callout for resource operations when update is denied', function () { $application = resourcePermissionCalloutApplicationFor('member'); $component = Livewire::test(ResourceOperations::class, ['resource' => $application]) ->assertSee('Insufficient permissions') ->assertSee('permission to clone or move this resource') ->assertSee('team administrator for access') ->assertDontSee('Access Restricted') ->assertDontSee("You don't have permission to clone resources") ->assertDontSee("You don't have permission to move resources"); expect(substr_count($component->html(), 'Insufficient permissions'))->toBe(1) ->and($component->html())->toContain('bg-red-50') ->and($component->html())->not->toContain('bg-warning-50'); }); it('shows the red insufficient permissions callout for tags when update is denied', function () { $application = resourcePermissionCalloutApplicationFor('member'); $component = Livewire::test(Tags::class, ['resource' => $application]) ->assertSee('Insufficient permissions') ->assertSee('permission to manage tags for this resource') ->assertDontSee('Access Restricted') ->assertDontSee("You don't have permission to manage tags"); expect(substr_count($component->html(), 'Insufficient permissions'))->toBe(1) ->and($component->html())->toContain('bg-red-50') ->and($component->html())->not->toContain('bg-warning-50'); });