> */ private array $steps = []; protected function setUp(): void { parent::setUp(); $this->travelTo(CarbonImmutable::parse('2026-10-23 18:00')); $this->seed([PropertySeeder::class, SiteSeeder::class]); $this->property = Property::sole(); Storage::fake('local'); Storage::fake('public'); Content::save(['contract.terms' => '
Echte Bedingungen
', 'stay.cancellation' => 'Echtes Storno
']); config(['mail.default' => 'array', 'fewo.spam.min_seconds' => 0]); Mail::swap(new MailManager($this->app)); Settings::tenant()->update(['bank_iban' => 'DE02120300000000202051', 'test_recipient' => 'test@example.org']); Http::preventStrayRequests(); BehaviourSnapshot::reset(); } public function test_a1_complete_request_automatic_offer_acceptance_and_payment(): void { $this->automatic(); $booking = $this->request(['street' => 'Lindenallee 12', 'postal_code' => '10115', 'city' => 'Berlin', 'country' => 'DE']); $this->capture('request', $booking); app(AcceptOffer::class)->handle($booking->fresh(), $booking->fresh()->offer_version); $this->capture('accepted', $booking); app(RecordPayment::class)->handle($booking->fresh(), (int) $booking->fresh()->deposit, now()); $this->capture('deposit', $booking); $this->travelTo($booking->fresh()->arrival->subDays(2)->setTime(9, 0)); $this->schedulers(); $this->capture('before_arrival', $booking); $this->travelTo($booking->fresh()->departure->addDays(3)->setTime(9, 0)); $this->schedulers(); $this->capture('after_departure', $booking); $this->assertBehaviour('a1_complete'); } public function test_a1_missing_address_clarification_hold_data_request_and_late_answer(): void { $this->automatic(['clarification_hold_auto_minutes' => 120, 'data_request_mode' => 'automatic']); $booking = $this->request([]); $this->capture('request', $booking); $this->travelTo(now()->addHours(2)->addMinutes(5)); $this->schedulers(); $this->capture('clarification_expired', $booking); $this->travelTo(now()->addHours(23)); $this->schedulers(); $this->capture('first_reminder', $booking); app(ContributeCaseFacts::class)->handle($booking->fresh(), ['guest.street' => 'Lindenallee 12', 'guest.postal_code' => '10115', 'guest.city' => 'Berlin', 'guest.country' => 'DE'], FactSource::GuestLink); $this->capture('answer', $booking); app(ContributeCaseFacts::class)->handle($booking->fresh(), ['guest.street' => 'Lindenallee 12'], FactSource::GuestLink); $this->capture('answer_repeated', $booking); $this->travelTo(now()->addHours(49)); $this->schedulers(); $this->capture('offer_expired', $booking); $this->assertBehaviour('a1_missing_address'); } public function test_a1_late_answer_when_the_dates_are_taken_meanwhile(): void { $this->automatic(['clarification_hold_auto_minutes' => 30, 'data_request_mode' => 'automatic']); $booking = $this->request([]); $this->travelTo(now()->addHour()); $this->schedulers(); $this->capture('clarification_expired', $booking); $other = $this->request(['street' => 'Weg 1', 'postal_code' => '20095', 'city' => 'Hamburg', 'country' => 'DE'], 'zweiter@example.org'); $this->capture('other_offer', $other); app(ContributeCaseFacts::class)->handle($booking->fresh(), ['guest.street' => 'Lindenallee 12', 'guest.postal_code' => '10115', 'guest.city' => 'Berlin', 'guest.country' => 'DE'], FactSource::GuestLink); $this->capture('answer_dates_taken', $booking); $this->assertBehaviour('a1_dates_taken'); } public function test_a1_manual_offer_and_rejection(): void { $booking = $this->request(['street' => 'Lindenallee 12', 'postal_code' => '10115', 'city' => 'Berlin', 'country' => 'DE']); $this->capture('request', $booking); app(SendOffer::class)->handle($booking->fresh()); $this->capture('offer', $booking); app(SendOffer::class)->handle($booking->fresh()); $this->capture('offer_version_2', $booking); app(RejectOffer::class)->handle($booking->fresh(), $booking->fresh()->offer_version); $this->capture('rejected', $booking); $this->assertBehaviour('a1_manual_reject'); } public function test_a1_information_wish_and_binding_confirmation(): void { $this->automatic(['pre_reservation' => false]); DocumentReleases::set(DocumentKind::Information, true, 'Test'); $booking = $this->request(['street' => 'Lindenallee 12', 'postal_code' => '10115', 'city' => 'Berlin', 'country' => 'DE']); $this->capture('information', $booking); app(SubmitBookingWish::class)->handle($booking->fresh(), $booking->fresh()->information_version); $this->capture('wish', $booking); $this->travelTo(now()->addMinutes(10)); $this->schedulers(); $this->capture('after_schedulers', $booking); $this->assertBehaviour('a1_information'); } public function test_a2_portal_inquiry_without_details(): void { $this->automatic(['clarification_hold_auto_minutes' => 60, 'data_request_mode' => 'automatic']); $channel = $this->channel('FeWo-direkt', 'mixed'); $booking = app(TakeOverPortalInquiry::class)->handle($channel, CarbonImmutable::parse('2026-11-14'), CarbonImmutable::parse('2026-11-18'), 'HA-ANF1'); $this->capture('inquiry', $booking); app(ContributeCaseFacts::class)->handle($booking->fresh(), ['guest.first_name' => 'Gesa', 'guest.last_name' => 'Gast', 'guest.email' => 'gesa@example.org', 'booking.guests' => '2'], FactSource::PortalMail); $this->capture('contact', $booking); app(ContributeCaseFacts::class)->handle($booking->fresh(), ['guest.street' => 'Lindenallee 12', 'guest.postal_code' => '10115', 'guest.city' => 'Berlin', 'guest.country' => 'DE'], FactSource::Email); $this->capture('address', $booking); $this->assertBehaviour('a2_inquiry'); } public function test_a3_portal_booking_with_own_documents_and_payments(): void { $this->automatic(); $channel = $this->channel('Destination Solutions', 'portal_booking'); $booking = app(TakeOverExternalBooking::class)->handle($this->property, $channel, CarbonImmutable::parse('2026-12-05'), CarbonImmutable::parse('2026-12-12'), ['portal_reference' => 'DS-1']); $this->capture('booking', $booking); app(ContributeCaseFacts::class)->handle($booking->fresh(), ['guest.first_name' => 'Dora', 'guest.last_name' => 'Gast', 'guest.email' => 'dora@example.org', 'booking.guests' => '2'], FactSource::PortalMail); $this->capture('guest', $booking); app(RecordPortalAmounts::class)->handle($booking->fresh(), 98000, [], [], 'Destination Solutions'); $this->capture('price', $booking); app(RecordPortalAmounts::class)->handle($booking->fresh(), 98000, [], [], 'Destination Solutions'); $this->capture('price_repeated', $booking); $this->assertBehaviour('a3_booking'); } public function test_a4_portal_booking_with_portal_payments(): void { $this->automatic(); $channel = $this->channel('FeWo-direkt', 'mixed', ['booking' => ['payments' => 'portal']]); $booking = app(TakeOverExternalBooking::class)->handle($this->property, $channel, CarbonImmutable::parse('2027-07-10'), CarbonImmutable::parse('2027-07-17'), ['portal_reference' => 'HA-A4', 'portal_total' => 97951, 'guests' => 2]); $this->capture('booking', $booking); app(ContributeCaseFacts::class)->handle($booking->fresh(), ['guest.first_name' => 'Fiete', 'guest.last_name' => 'Gast', 'guest.email' => 'fiete@example.org'], FactSource::PortalMail); $this->capture('guest', $booking); app(RecordPortalAmounts::class)->handle($booking->fresh(), null, [['kind' => 'payout_announced', 'amount' => 89469]], [['amount' => 39061, 'paid_on' => '2026-10-23']], 'FeWo-direkt'); $this->capture('portal_amounts', $booking); app(RecordPortalAmounts::class)->handle($booking->fresh(), null, [['kind' => 'payout_announced', 'amount' => 89469]], [['amount' => 39061, 'paid_on' => '2026-10-23']], 'FeWo-direkt'); $this->capture('portal_amounts_repeated', $booking); $this->assertBehaviour('a4_booking'); } public function test_a5_portal_booking_with_portal_documents(): void { $this->automatic(); $channel = $this->channel('Portal A5', 'portal_booking', ['booking' => ['payments' => 'portal', 'documents' => 'portal', 'guest_messages' => 'portal']]); $booking = app(TakeOverExternalBooking::class)->handle($this->property, $channel, CarbonImmutable::parse('2026-12-19'), CarbonImmutable::parse('2026-12-23'), ['portal_reference' => 'P5-1', 'portal_total' => 60000]); $this->capture('booking', $booking); $this->assertBehaviour('a5_booking'); } public function test_portal_mail_booking_and_cancellation_report(): void { $channel = $this->channel('FeWo-direkt', 'mixed', [], ['email_senders' => 'fewo-direkt.de']); $channel->update(['case_intake' => 'create']); $text = "Gast: Max Mustermann\nAnreise: Sa., 7. Nov. 2026\nAbreise: Di., 10. Nov. 2026\nReisende: 2 Erwachsene\nBuchungsnummer: HA-7X3K9Q"; app(ProcessPortalMail::class)->handle(new PortalMail('