Akte auch fuer Portal-Reservierungen aus dem Kalender, Ablauf mit Aktivitaeten, Verlauf, Standardprozess je Portal
Deploy FeWo mit PipelineManager / deploy (push) Successful in 3m34s
Deploy FeWo mit PipelineManager / deploy (push) Successful in 3m34s
- Akte anlegen aus einer importierten Portal-Reservierung (Belegung bleibt durchgehend belegt, Kalendereintrag wird Spiegelung) - Akte: Standardprozess (Portal/Vorlage/Storno/Anlagen), Meilensteine mit Aktivitaeten und Aktionshinweis, chronologischer Verlauf - Kanalformular: Abschnitt Standardprozess je Buchungstyp mit Anzeige, was die Vorlage mitbringt - Portalpreis als gemeinsame Logik (PortalPrice) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
5ba9ae08ab
commit
81c025f1ee
10 files changed
+450
-75
No files matched your search
@@ -2,10 +2,12 @@
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use App\Actions\OpenPortalFile;
|
||||
use App\Actions\ProvideGuestContact;
|
||||
use App\Actions\RecordPortalBooking;
|
||||
use App\Actions\ResolveChannelOccupation;
|
||||
use App\Actions\SetBookingStatus;
|
||||
use App\Availability\AvailabilityChecker;
|
||||
use App\Enums\BookingStatus;
|
||||
use App\Enums\ChannelBookingModel;
|
||||
use App\Enums\OccupationKind;
|
||||
@@ -13,6 +15,7 @@
|
||||
use App\Filament\Resources\Bookings\Pages\CreateBooking;
|
||||
use App\Filament\Resources\Bookings\Pages\ListBookings;
|
||||
use App\Filament\Resources\Bookings\Pages\ViewBooking;
|
||||
use App\Filament\Resources\PortalOccupations\Pages\ViewPortalOccupation;
|
||||
use App\Mail\BookingConfirmed;
|
||||
use App\Models\BlockedPeriod;
|
||||
use App\Models\Booking;
|
||||
@@ -215,6 +218,58 @@ public function test_an_independent_occupation_with_a_booking_channel_is_no_long
|
||||
$this->assertSame(OccupationKind::Reservation, $block->fresh()->occupation_kind);
|
||||
}
|
||||
|
||||
public function test_a_portal_reservation_from_the_calendar_gets_a_booking_file_and_stays_occupied(): void
|
||||
{
|
||||
$block = BlockedPeriod::factory()->for($this->property)->create(['channel_id' => $this->portal->id, 'source' => 'channel', 'external_uid' => 'u2', 'starts_on' => '2026-12-10', 'ends_on' => '2026-12-14', 'occupation_kind' => OccupationKind::Reservation]);
|
||||
$checker = app(AvailabilityChecker::class);
|
||||
$this->assertFalse($checker->isAvailable($this->property, CarbonImmutable::parse('2026-12-10'), CarbonImmutable::parse('2026-12-14')));
|
||||
|
||||
$booking = app(OpenPortalFile::class)->handle($block);
|
||||
|
||||
$this->assertSame(BookingStatus::Confirmed, $booking->status);
|
||||
$this->assertSame($this->portal->id, $booking->origin_channel_id);
|
||||
$this->assertSame(BookingProgress::PORTAL_BOOKING, BookingProgress::kind($booking));
|
||||
$this->assertSame('', $booking->guest->email);
|
||||
$this->assertTrue($block->fresh()->is_representation);
|
||||
$this->assertSame($booking->id, $block->fresh()->linked_booking_id);
|
||||
$this->assertFalse($checker->isAvailable($this->property, CarbonImmutable::parse('2026-12-10'), CarbonImmutable::parse('2026-12-14')));
|
||||
$this->assertSame($booking->id, app(OpenPortalFile::class)->handle($block->fresh())->id);
|
||||
$this->assertSame(1, Booking::query()->count());
|
||||
}
|
||||
|
||||
public function test_a_blocked_period_gets_no_booking_file(): void
|
||||
{
|
||||
$block = BlockedPeriod::factory()->for($this->property)->create(['channel_id' => $this->portal->id, 'source' => 'channel', 'external_uid' => 'u3', 'starts_on' => '2026-12-10', 'ends_on' => '2026-12-14', 'occupation_kind' => OccupationKind::Block]);
|
||||
|
||||
$this->expectException(ReservationException::class);
|
||||
app(OpenPortalFile::class)->handle($block);
|
||||
}
|
||||
|
||||
public function test_the_occupation_page_offers_the_file_and_leads_to_the_booking(): void
|
||||
{
|
||||
$block = BlockedPeriod::factory()->for($this->property)->create(['channel_id' => $this->portal->id, 'source' => 'channel', 'external_uid' => 'u4', 'starts_on' => '2026-12-10', 'ends_on' => '2026-12-14', 'occupation_kind' => OccupationKind::Reservation]);
|
||||
$this->actingAs(User::factory()->create());
|
||||
|
||||
Livewire::test(ViewPortalOccupation::class, ['record' => $block->getRouteKey()])->callAction('openFile')->assertRedirect();
|
||||
|
||||
$booking = Booking::query()->sole();
|
||||
Livewire::test(ViewBooking::class, ['record' => $booking->getRouteKey()])
|
||||
->assertSee('Ablauf: Meilensteine und Aktivitäten')
|
||||
->assertSee('Bisheriger Verlauf')
|
||||
->assertSee('Standardprozess')
|
||||
->assertSee('Kontaktdaten eintragen');
|
||||
}
|
||||
|
||||
public function test_every_milestone_lists_its_activities_and_the_history_records_what_happened(): void
|
||||
{
|
||||
$booking = $this->record(RecordPortalBooking::CONFIRM);
|
||||
|
||||
$steps = collect(BookingProgress::steps($booking))->keyBy('label');
|
||||
$this->assertFalse($steps['Gast & Kontaktdaten']['activities'][1]['done']);
|
||||
$this->assertSame('Kontaktdaten eintragen', $steps['Gast & Kontaktdaten']['activities'][1]['action']);
|
||||
$this->assertSame(['Vorgang angelegt (FeWo-direkt)', 'Buchung verbindlich bestätigt'], array_column(BookingProgress::history($booking), 'label'));
|
||||
}
|
||||
|
||||
private function record(string $process, ?int $total = null, ?string $reference = null, string $arrival = '2026-11-07', string $departure = '2026-11-10'): Booking
|
||||
{
|
||||
return app(RecordPortalBooking::class)->handle(
|
||||
|
||||
Reference in new issue
Block a user