Files
Lars StommerandClaude Opus 5.5 99e0ba4040 Dashboard: Kennzahlen und nächste Aufenthalte
- Offene Anfragen, Anreisen 14 Tage, offene/überfällige Zahlungen, Auslastung, Portal-Status
- Tabelle der Aufenthalte der nächsten 30 Tage mit offenen Beträgen und Anreiseinfo-Status
- Nur für Rollen Administrator und Vermietung

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 13:31:05 +02:00

50 lines
1.6 KiB
PHP

<?php
namespace Tests\Feature;
use App\Enums\BookingStatus;
use App\Enums\UserRole;
use App\Filament\Widgets\BookingStats;
use App\Filament\Widgets\UpcomingStays;
use App\Models\Booking;
use App\Models\Property;
use App\Models\User;
use Carbon\CarbonImmutable;
use Database\Seeders\PropertySeeder;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Livewire\Livewire;
use Tests\TestCase;
class DashboardTest extends TestCase
{
use RefreshDatabase;
protected function setUp(): void
{
parent::setUp();
$this->travelTo(CarbonImmutable::parse('2026-10-22 10:00'));
$this->seed(PropertySeeder::class);
}
public function test_dashboard_shows_key_figures_and_upcoming_stays(): void
{
$this->actingAs(User::factory()->create());
$property = Property::sole();
Booking::factory()->for($property)->reserved()->create(['arrival' => '2026-12-01', 'departure' => '2026-12-05']);
$soon = Booking::factory()->for($property)->create(['status' => BookingStatus::Confirmed, 'arrival' => '2026-10-30', 'departure' => '2026-11-02', 'deposit_due_on' => '2026-10-20']);
$this->get('/admin')->assertOk();
Livewire::test(BookingStats::class)->assertSee('Offene Anfragen')->assertSee('1 überfällig');
Livewire::test(UpcomingStays::class)->assertCanSeeTableRecords([$soon]);
}
public function test_content_role_does_not_see_booking_widgets(): void
{
$this->actingAs(User::factory()->role(UserRole::Content)->create());
$this->assertFalse(BookingStats::canView());
$this->get('/admin')->assertOk()->assertDontSee('Offene Anfragen');
}
}