v0.11 U2: Angebots-Gate, gemeinsamer Fakteneingang mit Herkunft

- CaseRequirements: Vor einem eigenen verbindlichen Angebot und vor der
  verbindlichen Bestätigung eines Buchungswunsches müssen Vor- und
  Nachname, E-Mail, vollständige Anschrift mit Land, Personenzahl und
  Zeitraum vorliegen – harter Blocker, auch von Hand (G2a, B3). Die
  Auskunft unter Vorbehalt bleibt ohne dieses Gate.
- ContributeCaseFacts (S5): jede Angabe mit Herkunft und Ergebnis in
  case_facts; fehlend → übernommen, gleich → bestätigt, abweichend vom
  Gast → Prüfaufgabe (Kartei bleibt), Vermieterin maßgeblich, Zeitraum und
  Personen → Änderungswunsch; idempotent; danach einmal CaseAutomation.
- ProvideGuestContact und Webformular nutzen den Fakteneingang.
- Land als ISO-Code mit „Deutschland“ als änderbarem Formularstandard;
  guests.country ohne stillen Standardwert (B4).
- Testdaten bestehender Tests um Anschriften ergänzt.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
LarsandClaude Opus 5.5 committed 2026-11-03 13:07:18 +01:00
1 parent 799869c6a4
commit ccac78a6c9
33 files changed
+1041 -47

No files matched your search

+1 -1
View File
@@ -214,7 +214,7 @@ private function request(string $email = 'gast@example.org', string $arrival = '
return app(CreateReservation::class)->handle(
$this->property->fresh(),
new StayRequest(CarbonImmutable::parse($arrival), CarbonImmutable::parse($departure), 2),
['first_name' => 'Gast', 'last_name' => 'Test', 'email' => $email],
['first_name' => 'Gast', 'last_name' => 'Test', 'email' => $email, 'street' => 'Strandweg 1', 'postal_code' => '18225', 'city' => 'Kühlungsborn', 'country' => 'DE'],
)->fresh(['guest', 'property']);
}
+1 -1
View File
@@ -215,7 +215,7 @@ private function request(string $email = 'gast@example.org', string $arrival = '
return app(CreateReservation::class)->handle(
$this->property->fresh(),
new StayRequest(CarbonImmutable::parse($arrival), CarbonImmutable::parse($departure), 2),
['first_name' => 'Gesa', 'last_name' => 'Gast', 'email' => $email],
['first_name' => 'Gesa', 'last_name' => 'Gast', 'email' => $email, 'street' => 'Strandweg 1', 'postal_code' => '18225', 'city' => 'Kühlungsborn', 'country' => 'DE'],
sendMails: false,
originChannel: $channel,
);
+240
View File
@@ -0,0 +1,240 @@
<?php
namespace Tests\Feature;
use App\Actions\ContributeCaseFacts;
use App\Actions\CreateReservation;
use App\Actions\DecideBookingWish;
use App\Actions\SendInformation;
use App\Actions\SendOffer;
use App\Actions\SubmitBookingWish;
use App\Actions\TakeOverExternalBooking;
use App\Documents\DocumentReleases;
use App\Enums\BookingStatus;
use App\Enums\BookingTaskKind;
use App\Enums\DocumentKind;
use App\Enums\FactSource;
use App\Exceptions\ReservationException;
use App\Models\Booking;
use App\Models\BookingTask;
use App\Models\CaseFact;
use App\Models\Channel;
use App\Models\Guest;
use App\Models\Property;
use App\Pricing\StayRequest;
use App\Process\CaseRequirements;
use App\Support\Content;
use App\Support\Settings;
use Carbon\CarbonImmutable;
use Database\Seeders\PropertySeeder;
use Database\Seeders\SiteSeeder;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Mail;
use Illuminate\Support\Facades\Storage;
use Tests\TestCase;
/**
* v0.11 package U2: required details before an own binding offer and before the binding confirmation of a booking wish
* (G2a, E-032, B3, B4, M01) and the common fact intake with source, conflict and change request (S5, CH-03, E-038,
* M03, M06).
*/
class CaseFactIntakeTest extends TestCase
{
use RefreshDatabase;
private const ADDRESS = ['street' => 'Strandweg 1', 'postal_code' => '18225', 'city' => 'Kühlungsborn', 'country' => 'DE'];
private Property $property;
protected function setUp(): void
{
parent::setUp();
$this->travelTo(CarbonImmutable::parse('2026-10-22 10:00'));
$this->seed([PropertySeeder::class, SiteSeeder::class]);
$this->property = Property::sole();
Mail::fake();
Storage::fake('local');
Http::fake(['*' => Http::response('', 500)]);
Content::save(['contract.terms' => '<p>Echte Bedingungen</p>', 'stay.cancellation' => '<p>Echtes Storno</p>']);
Settings::tenant()->update(['bank_iban' => 'DE02120300000000202051']);
}
/** M01 */
public function test_a_request_without_address_gets_no_offer_neither_automatically_nor_by_hand(): void
{
Settings::tenant()->update(['process_defaults' => ['processing' => 'automatic']]);
$booking = $this->request(sendMails: true);
$this->assertSame(0, $booking->fresh()->offer_version);
$this->assertSame(['guest.street', 'guest.postal_code', 'guest.city', 'guest.country'], CaseRequirements::missing($booking));
try {
app(SendOffer::class)->handle($booking->fresh(), ['acknowledged' => true]);
$this->fail('An offer without address must not go out.');
} catch (ReservationException $exception) {
$this->assertStringContainsString('Straße und Hausnummer, PLZ, Ort, Land', $exception->getMessage());
}
$this->assertSame(BookingStatus::Reserved, $booking->fresh()->status);
}
public function test_with_the_full_address_the_offer_goes_out_automatically(): void
{
Settings::tenant()->update(['process_defaults' => ['processing' => 'automatic']]);
$booking = $this->request(address: self::ADDRESS, sendMails: true);
$this->assertSame(BookingStatus::OfferSent, $booking->fresh()->status);
}
/** B3: the information "unter Vorbehalt" stays possible, the binding confirmation of the wish does not. */
public function test_an_information_needs_no_address_but_the_binding_confirmation_of_the_wish_does(): void
{
Settings::tenant()->update(['process_defaults' => ['processing' => 'automatic', 'pre_reservation' => false]]);
DocumentReleases::set(DocumentKind::Information, true, 'Test');
$booking = $this->request(sendMails: true)->fresh();
$this->assertSame(1, $booking->information_version, 'the information went out without address');
$outcome = app(SubmitBookingWish::class)->handle($booking, 1);
$this->assertSame(SubmitBookingWish::PENDING, $outcome);
$this->assertStringContainsString('fehlen noch Angaben', implode(' ', $booking->fresh()->wish['findings']));
$this->expectException(ReservationException::class);
app(DecideBookingWish::class)->confirm($booking->fresh());
}
public function test_the_wish_is_confirmed_once_the_address_is_there(): void
{
Settings::tenant()->update(['process_defaults' => ['pre_reservation' => false]]);
$booking = $this->request();
app(SendInformation::class)->handle($booking->fresh(), ['acknowledged' => true]);
app(SubmitBookingWish::class)->handle($booking->fresh(), 1);
app(ContributeCaseFacts::class)->handle($booking->fresh(), $this->prefixed(self::ADDRESS), FactSource::Landlord);
app(DecideBookingWish::class)->confirm($booking->fresh());
$this->assertSame(BookingStatus::Confirmed, $booking->fresh()->status);
}
/** B4 */
public function test_an_empty_country_is_missing_and_never_assumed(): void
{
$booking = $this->request(address: [...self::ADDRESS, 'country' => null]);
$this->assertSame(['guest.country'], CaseRequirements::missing($booking));
$this->assertNull($booking->guest->fresh()->country);
}
public function test_missing_values_are_taken_over_equal_ones_confirmed_and_different_ones_put_to_the_landlord(): void
{
$booking = $this->request(address: ['street' => 'Strandweg 1']);
$result = app(ContributeCaseFacts::class)->handle($booking, ['guest.street' => 'Am Deich 7', 'guest.postal_code' => '18225', 'guest.city' => 'Kühlungsborn', 'guest.first_name' => 'gesa', 'guest.phone' => 'kein Telefon?'], FactSource::Email, ['reference' => 'mail-1']);
$guest = $booking->guest->fresh();
$this->assertSame('Strandweg 1', $guest->street, 'the guest record is not written over');
$this->assertSame('18225', $guest->postal_code);
$this->assertSame(['guest.postal_code', 'guest.city', 'guest.phone'], $result->fields(CaseFact::APPLIED));
$this->assertSame(['guest.first_name'], $result->fields(CaseFact::CONFIRMED));
$this->assertSame(['guest.street'], $result->fields(CaseFact::CONFLICT));
$task = BookingTask::query()->where('booking_id', $booking->id)->where('kind', BookingTaskKind::FactConflict)->sole();
$this->assertStringContainsString('Am Deich 7', $task->note);
$this->assertStringContainsString('Strandweg 1', $task->note);
$landlord = app(ContributeCaseFacts::class)->handle($booking->fresh(), ['guest.street' => 'Am Deich 7'], FactSource::Landlord);
$this->assertSame(['guest.street'], $landlord->fields(CaseFact::APPLIED));
$this->assertSame('Am Deich 7', $booking->guest->fresh()->street);
$this->assertSame('Strandweg 1', CaseFact::query()->where('source', FactSource::Landlord)->sole()->previous_value);
}
/** M03 */
public function test_the_same_contribution_twice_is_recorded_once(): void
{
$booking = $this->request();
app(ContributeCaseFacts::class)->handle($booking, ['guest.phone' => '038293 1234'], FactSource::GuestLink, ['reference' => 'link-v1']);
$again = app(ContributeCaseFacts::class)->handle($booking->fresh(), ['guest.phone' => '038293 1234'], FactSource::GuestLink, ['reference' => 'link-v1']);
$this->assertTrue($again->isEmpty());
$this->assertSame(1, CaseFact::query()->where('field', 'guest.phone')->count());
$this->assertSame(2, $booking->events()->where('type', 'facts')->count(), 'the form and the first link contribution, not the repeated one');
}
/** M06 core: a binding booking gets administrative details, a change of the stay is only a request. */
public function test_a_binding_booking_takes_administrative_details_but_a_new_date_is_only_a_change_request(): void
{
$booking = $this->portalBooking(guest: ['first_name' => 'Erika', 'last_name' => 'Muster', 'email' => 'erika@example.org']);
$result = app(ContributeCaseFacts::class)->handle($booking, ['guest.phone' => '0171 555', 'booking.departure' => '2026-12-12', 'booking.guests' => '3'], FactSource::Email, ['reference' => 'mail-2']);
$booking->refresh();
$this->assertSame(BookingStatus::Confirmed, $booking->status);
$this->assertSame('2026-12-08', $booking->departure->toDateString(), 'nothing about the booking changed');
$this->assertNull($booking->guests);
$this->assertSame('0171 555', $booking->guest->phone);
$this->assertSame(['booking.departure', 'booking.guests'], $result->fields(CaseFact::CHANGE_REQUEST));
$this->assertSame(2, BookingTask::query()->where('booking_id', $booking->id)->where('kind', BookingTaskKind::ChangeRequest)->count());
$portal = app(ContributeCaseFacts::class)->handle($booking, ['booking.guests' => '3'], FactSource::PortalMail, ['reference' => 'portal-1']);
$this->assertSame(['booking.guests'], $portal->fields(CaseFact::APPLIED), 'the portal itself may complete an unknown number of guests');
}
public function test_a_case_without_guest_gets_one_from_a_name_but_never_joins_a_known_address_silently(): void
{
Guest::factory()->create(['email' => 'bekannt@example.org']);
$booking = $this->portalBooking();
$known = app(ContributeCaseFacts::class)->handle($booking, ['guest.first_name' => 'Kai', 'guest.last_name' => 'Kurz', 'guest.email' => 'bekannt@example.org'], FactSource::Email, ['reference' => 'mail-3']);
$this->assertNull($booking->fresh()->guest_id);
$this->assertSame(['guest.first_name', 'guest.last_name', 'guest.email'], $known->fields(CaseFact::CONFLICT));
app(ContributeCaseFacts::class)->handle($booking->fresh(), ['guest.first_name' => 'Kai', 'guest.last_name' => 'Kurz', 'guest.email' => 'kai@example.org'], FactSource::PortalMail, ['reference' => 'mail-4']);
$this->assertSame('kai@example.org', $booking->fresh()->guest->email);
}
/** S6: once the details are complete the existing process carries on by itself. */
public function test_completing_the_address_continues_an_automatic_case(): void
{
Settings::tenant()->update(['process_defaults' => ['processing' => 'automatic']]);
$booking = $this->request(sendMails: true);
$this->assertSame(0, $booking->fresh()->offer_version);
app(ContributeCaseFacts::class)->handle($booking->fresh(), $this->prefixed(self::ADDRESS), FactSource::GuestLink, ['reference' => 'link-v1']);
$this->assertSame(BookingStatus::OfferSent, $booking->fresh()->status);
}
/**
* @param array<string, ?string> $address
*/
private function request(array $address = [], bool $sendMails = false): Booking
{
return app(CreateReservation::class)->handle(
$this->property->fresh(),
new StayRequest(CarbonImmutable::parse('2026-11-07'), CarbonImmutable::parse('2026-11-10'), 2),
['first_name' => 'Gesa', 'last_name' => 'Gast', 'email' => 'gesa@example.org', ...$address],
sendMails: $sendMails,
);
}
/**
* @param array<string, ?string>|null $guest
*/
private function portalBooking(?array $guest = null): Booking
{
$portal = Channel::factory()->for($this->property)->create(['name' => 'FeWo-direkt', 'booking_model' => 'portal_booking']);
return app(TakeOverExternalBooking::class)->handle($this->property, $portal, CarbonImmutable::parse('2026-12-05'), CarbonImmutable::parse('2026-12-08'), ['portal_reference' => 'HA-7', 'guest' => $guest]);
}
/**
* @param array<string, ?string> $address
* @return array<string, ?string>
*/
private function prefixed(array $address): array
{
return collect($address)->mapWithKeys(fn (?string $value, string $key): array => ['guest.'.$key => $value])->all();
}
}
+2 -2
View File
@@ -346,7 +346,7 @@ private function request(bool $sendMails = false): Booking
return app(CreateReservation::class)->handle(
$this->property->fresh(),
new StayRequest(CarbonImmutable::parse('2026-11-07'), CarbonImmutable::parse('2026-11-10'), 2),
['first_name' => 'Gesa', 'last_name' => 'Gast', 'email' => 'gesa@example.org'],
['first_name' => 'Gesa', 'last_name' => 'Gast', 'email' => 'gesa@example.org', 'street' => 'Strandweg 1', 'postal_code' => '18225', 'city' => 'Kühlungsborn', 'country' => 'DE'],
sendMails: $sendMails,
);
}
@@ -358,7 +358,7 @@ private function portalBooking(): Booking
$this->portal,
CarbonImmutable::parse('2026-12-05'),
CarbonImmutable::parse('2026-12-12'),
['portal_total' => 97951, 'portal_reference' => 'HA-77', 'guest' => ['first_name' => 'Erika', 'last_name' => 'Muster', 'email' => 'erika@example.org']],
['portal_total' => 97951, 'portal_reference' => 'HA-77', 'guest' => ['first_name' => 'Erika', 'last_name' => 'Muster', 'email' => 'erika@example.org', 'street' => 'Strandweg 1', 'postal_code' => '18225', 'city' => 'Kühlungsborn', 'country' => 'DE']],
);
}
+8 -8
View File
@@ -108,7 +108,7 @@ public function test_t01_own_request_handled_automatically(): void
$this->releaseTexts();
Settings::tenant()->update(['process_defaults' => ['processing' => 'automatic']]);
$booking = app(CreateReservation::class)->handle($this->property, new StayRequest(CarbonImmutable::parse('2026-11-07'), CarbonImmutable::parse('2026-11-10'), 2), ['first_name' => 'Gesa', 'last_name' => 'Gast', 'email' => 'gesa@example.org']);
$booking = app(CreateReservation::class)->handle($this->property, new StayRequest(CarbonImmutable::parse('2026-11-07'), CarbonImmutable::parse('2026-11-10'), 2), ['first_name' => 'Gesa', 'last_name' => 'Gast', 'email' => 'gesa@example.org', 'street' => 'Strandweg 1', 'postal_code' => '18225', 'city' => 'Kühlungsborn', 'country' => 'DE']);
$this->assertSame([BookingStatus::OfferSent, CaseType::A1], [$booking->status, $booking->case_type]);
Mail::assertSent(OfferMade::class, 1);
@@ -120,7 +120,7 @@ public function test_t01_own_request_handled_automatically(): void
public function test_t02_own_request_released_by_hand_and_accepted_by_the_guest(): void
{
Livewire::test(CreateBooking::class)
->fillForm(['kind' => BookingForm::INQUIRY, 'property_id' => $this->property->id, 'guests' => 2, 'arrival' => '2026-11-07', 'departure' => '2026-11-10', 'first_name' => 'Gesa', 'last_name' => 'Gast', 'email' => 'gesa@example.org', 'send_mails' => false])
->fillForm(['kind' => BookingForm::INQUIRY, 'property_id' => $this->property->id, 'guests' => 2, 'arrival' => '2026-11-07', 'departure' => '2026-11-10', 'first_name' => 'Gesa', 'last_name' => 'Gast', 'email' => 'gesa@example.org', 'street' => 'Strandweg 1', 'postal_code' => '18225', 'city' => 'Kühlungsborn', 'country' => 'DE', 'send_mails' => false])
->call('create')->assertHasNoFormErrors();
$booking = Booking::query()->sole();
$this->assertSame('Angebot prüfen und senden', WorkList::items()[0]['title']);
@@ -145,13 +145,13 @@ public function test_t03_missing_guest_data_becomes_a_task_and_the_case_continue
$this->releaseTexts();
Settings::tenant()->update(['process_defaults' => ['processing' => 'automatic']]);
Livewire::test(CreateBooking::class)
->fillForm(['kind' => BookingForm::INQUIRY, 'property_id' => $this->property->id, 'guests' => 2, 'arrival' => '2026-11-07', 'departure' => '2026-11-10', 'first_name' => 'Paul', 'last_name' => 'Telefon', 'send_mails' => true])
->fillForm(['kind' => BookingForm::INQUIRY, 'property_id' => $this->property->id, 'guests' => 2, 'arrival' => '2026-11-07', 'departure' => '2026-11-10', 'first_name' => 'Paul', 'last_name' => 'Telefon', 'street' => 'Strandweg 1', 'postal_code' => '18225', 'city' => 'Kühlungsborn', 'country' => 'DE', 'send_mails' => true])
->call('create')->assertHasNoFormErrors();
$booking = Booking::query()->sole();
$this->assertSame('E-Mail-Adresse des Gastes eintragen', WorkList::items()[0]['title']);
Livewire::test(ViewBooking::class, ['record' => $booking->getRouteKey()])
->callAction(TestAction::make('provideContact')->arguments([]), ['guest' => ['first_name' => 'Paul', 'last_name' => 'Telefon', 'email' => 'paul@example.org'], 'process' => ProvideGuestContact::AUTOMATIC, 'guest_confirmed' => false])
->callAction(TestAction::make('provideContact')->arguments([]), ['guest' => ['first_name' => 'Paul', 'last_name' => 'Telefon', 'email' => 'paul@example.org', 'street' => 'Strandweg 1', 'postal_code' => '18225', 'city' => 'Kühlungsborn', 'country' => 'DE'], 'process' => ProvideGuestContact::AUTOMATIC, 'guest_confirmed' => false])
->assertNotified('Kontaktdaten gespeichert, Angebot gesendet');
$this->assertSame(BookingStatus::OfferSent, $booking->fresh()->status);
@@ -258,7 +258,7 @@ public function test_t08_cancellation_takes_the_right_way(): void
->assertNotified('Buchung storniert');
$this->assertSame(BookingStatus::Cancelled, $portal->fresh()->status);
$request = app(CreateReservation::class)->handle($this->property, new StayRequest(CarbonImmutable::parse('2026-11-28'), CarbonImmutable::parse('2026-12-01'), 2), ['first_name' => 'Ina', 'last_name' => 'Anfrage', 'email' => 'ina@example.org'], sendMails: false);
$request = app(CreateReservation::class)->handle($this->property, new StayRequest(CarbonImmutable::parse('2026-11-28'), CarbonImmutable::parse('2026-12-01'), 2), ['first_name' => 'Ina', 'last_name' => 'Anfrage', 'email' => 'ina@example.org', 'street' => 'Strandweg 1', 'postal_code' => '18225', 'city' => 'Kühlungsborn', 'country' => 'DE'], sendMails: false);
Livewire::test(ViewBooking::class, ['record' => $request->getRouteKey()])
->callAction('end', ['reason' => 'Hund nicht erlaubt', 'notify' => false])
->assertNotified('Vorgang beendet');
@@ -385,7 +385,7 @@ public function test_t12_settings_hierarchy_is_applied_and_visible(): void
$this->assertSame([ProcessingMode::Automatic, 'tenant'], [$portalBooking->processing(), $portalBooking->source(ProcessSetting::Processing)], 'the booking intake inherits the default');
$this->assertSame(CaseType::A4, $portalBooking->caseType);
$case = app(CreateReservation::class)->handle($this->property->fresh(), new StayRequest(CarbonImmutable::parse('2026-11-07'), CarbonImmutable::parse('2026-11-10'), 2), ['first_name' => 'Gesa', 'last_name' => 'Gast', 'email' => 'gesa@example.org'], sendMails: false, originChannel: $fewo);
$case = app(CreateReservation::class)->handle($this->property->fresh(), new StayRequest(CarbonImmutable::parse('2026-11-07'), CarbonImmutable::parse('2026-11-10'), 2), ['first_name' => 'Gesa', 'last_name' => 'Gast', 'email' => 'gesa@example.org', 'street' => 'Strandweg 1', 'postal_code' => '18225', 'city' => 'Kühlungsborn', 'country' => 'DE'], sendMails: false, originChannel: $fewo);
$this->assertSame(ProcessingMode::Manual, $case->processingMode());
Livewire::test(ViewBooking::class, ['record' => $case->getRouteKey()])->callAction('automation', ['mode' => ProcessingMode::Automatic->value]);
$this->assertSame(ProcessingMode::Automatic, $case->fresh()->processingMode(), 'the case decision wins');
@@ -412,7 +412,7 @@ public function test_t13_test_operation_redirects_every_outgoing_message(): void
Settings::tenant()->update(['operating_mode' => Settings::MODE_TEST, 'test_recipient' => 'test@example.com']);
app(TenantContext::class)->set(Settings::tenant()->fresh());
$booking = app(CreateReservation::class)->handle($this->property, new StayRequest(CarbonImmutable::parse('2026-11-07'), CarbonImmutable::parse('2026-11-10'), 2), ['first_name' => 'Gesa', 'last_name' => 'Gast', 'email' => 'gesa@gast.example']);
$booking = app(CreateReservation::class)->handle($this->property, new StayRequest(CarbonImmutable::parse('2026-11-07'), CarbonImmutable::parse('2026-11-10'), 2), ['first_name' => 'Gesa', 'last_name' => 'Gast', 'email' => 'gesa@gast.example', 'street' => 'Strandweg 1', 'postal_code' => '18225', 'city' => 'Kühlungsborn', 'country' => 'DE']);
Livewire::test(ViewBooking::class, ['record' => $booking->getRouteKey()])->callAction(TestAction::make('sendOffer')->arguments([]));
$booking->refresh();
$this->post(URL::temporarySignedRoute('offers.accept', $booking->hold_expires_at, ['booking' => $booking, 'v' => $booking->offer_version]), ['terms' => '1']);
@@ -483,7 +483,7 @@ public function test_existing_manual_blocks_become_cases_without_changing_the_po
private function confirmedOwnBooking(): Booking
{
$booking = app(CreateReservation::class)->handle($this->property, new StayRequest(CarbonImmutable::parse('2026-11-07'), CarbonImmutable::parse('2026-11-10'), 2), ['first_name' => 'Gesa', 'last_name' => 'Gast', 'email' => 'gesa@example.org'], sendMails: false);
$booking = app(CreateReservation::class)->handle($this->property, new StayRequest(CarbonImmutable::parse('2026-11-07'), CarbonImmutable::parse('2026-11-10'), 2), ['first_name' => 'Gesa', 'last_name' => 'Gast', 'email' => 'gesa@example.org', 'street' => 'Strandweg 1', 'postal_code' => '18225', 'city' => 'Kühlungsborn', 'country' => 'DE'], sendMails: false);
Livewire::test(ViewBooking::class, ['record' => $booking->getRouteKey()])->callAction('confirm', ['notify' => false]);
return $booking->fresh();
+4 -4
View File
@@ -449,7 +449,7 @@ public function test_t24_settings_of_every_level_are_effective_in_the_whole_run(
$this->assertSame(BookingStatus::OfferSent, $direct->fresh()->status, 'landlord level: automatic offer with hold');
$this->assertNotNull($direct->fresh()->hold_expires_at);
$viaPortal = app(CreateReservation::class)->handle($this->property->fresh(), new StayRequest(CarbonImmutable::parse('2026-11-21'), CarbonImmutable::parse('2026-11-24'), 2), ['first_name' => 'Pia', 'last_name' => 'Portal', 'email' => 'pia@example.org'], originChannel: $this->manualPortal->fresh());
$viaPortal = app(CreateReservation::class)->handle($this->property->fresh(), new StayRequest(CarbonImmutable::parse('2026-11-21'), CarbonImmutable::parse('2026-11-24'), 2), ['first_name' => 'Pia', 'last_name' => 'Portal', 'email' => 'pia@example.org', 'street' => 'Strandweg 1', 'postal_code' => '18225', 'city' => 'Kühlungsborn', 'country' => 'DE'], originChannel: $this->manualPortal->fresh());
$this->assertSame([0, 0, null], [$viaPortal->fresh()->information_version, $viaPortal->fresh()->offer_version, $viaPortal->fresh()->hold_expires_at], 'portal level: no hold, manual');
$this->assertSame('sendInformation', CaseActivities::next($viaPortal->fresh())?->action);
@@ -516,7 +516,7 @@ public function test_special_cases_of_preparation_and_closing(): void
$this->assertContains('Der Gesamtpreis laut FeWo-direkt fehlt.', CaseClosure::commercialPoints($portal), 'an unknown portal price is no invented 0');
// Cancellation two days before arrival: preparation is dropped, costs keep the case open commercially.
$own = app(CreateReservation::class)->handle($this->property, new StayRequest(CarbonImmutable::parse('2026-11-05'), CarbonImmutable::parse('2026-11-08'), 2), ['first_name' => 'Kurt', 'last_name' => 'Kurzfristig', 'email' => 'kurt@example.org'], sendMails: false);
$own = app(CreateReservation::class)->handle($this->property, new StayRequest(CarbonImmutable::parse('2026-11-05'), CarbonImmutable::parse('2026-11-08'), 2), ['first_name' => 'Kurt', 'last_name' => 'Kurzfristig', 'email' => 'kurt@example.org', 'street' => 'Strandweg 1', 'postal_code' => '18225', 'city' => 'Kühlungsborn', 'country' => 'DE'], sendMails: false);
Livewire::test(ViewBooking::class, ['record' => $own->getRouteKey()])->callAction('confirm', ['notify' => false]);
app(SendBookingReminders::class)->handle();
$this->assertTrue(BookingTask::query()->where('booking_id', $own->id)->where('kind', BookingTaskKind::Service)->exists());
@@ -569,7 +569,7 @@ public function test_existing_payment_statuses_are_only_corrected_on_request():
private function request(string $email = 'gesa@example.org', string $arrival = '2026-11-07', string $departure = '2026-11-10'): Booking
{
return app(CreateReservation::class)->handle($this->property->fresh(), new StayRequest(CarbonImmutable::parse($arrival), CarbonImmutable::parse($departure), 2), ['first_name' => 'Gesa', 'last_name' => 'Gast', 'email' => $email]);
return app(CreateReservation::class)->handle($this->property->fresh(), new StayRequest(CarbonImmutable::parse($arrival), CarbonImmutable::parse($departure), 2), ['first_name' => 'Gesa', 'last_name' => 'Gast', 'email' => $email, 'street' => 'Strandweg 1', 'postal_code' => '18225', 'city' => 'Kühlungsborn', 'country' => 'DE']);
}
private function sendInformation(Booking $booking): void
@@ -593,7 +593,7 @@ private function automaticWithoutHold(): void
private function confirmedOwnBooking(): Booking
{
$booking = app(CreateReservation::class)->handle($this->property, new StayRequest(CarbonImmutable::parse('2026-11-07'), CarbonImmutable::parse('2026-11-10'), 2), ['first_name' => 'Gesa', 'last_name' => 'Gast', 'email' => 'gesa@example.org'], sendMails: false);
$booking = app(CreateReservation::class)->handle($this->property, new StayRequest(CarbonImmutable::parse('2026-11-07'), CarbonImmutable::parse('2026-11-10'), 2), ['first_name' => 'Gesa', 'last_name' => 'Gast', 'email' => 'gesa@example.org', 'street' => 'Strandweg 1', 'postal_code' => '18225', 'city' => 'Kühlungsborn', 'country' => 'DE'], sendMails: false);
Livewire::test(ViewBooking::class, ['record' => $booking->getRouteKey()])->callAction('confirm', ['notify' => false]);
return $booking->fresh();
+4 -4
View File
@@ -104,7 +104,7 @@ public function test_missing_data_stops_the_case_with_a_task_and_it_continues_au
Livewire::test(CreateBooking::class)
->fillForm([
'kind' => BookingForm::INQUIRY, 'property_id' => $this->property->id, 'guests' => 2,
'arrival' => '2026-11-07', 'departure' => '2026-11-10', 'first_name' => 'Paul', 'last_name' => 'Telefon', 'send_mails' => true,
'arrival' => '2026-11-07', 'departure' => '2026-11-10', 'first_name' => 'Paul', 'last_name' => 'Telefon', 'street' => 'Strandweg 1', 'postal_code' => '18225', 'city' => 'Kühlungsborn', 'country' => 'DE', 'send_mails' => true,
])
->call('create')
->assertHasNoFormErrors();
@@ -116,7 +116,7 @@ public function test_missing_data_stops_the_case_with_a_task_and_it_continues_au
Mail::assertNotSent(OfferMade::class);
Livewire::test(ViewBooking::class, ['record' => $booking->getRouteKey()])
->callAction(TestAction::make('provideContact')->arguments([]), ['guest' => ['first_name' => 'Paul', 'last_name' => 'Telefon', 'email' => 'paul@example.org'], 'process' => ProvideGuestContact::AUTOMATIC, 'guest_confirmed' => false])
->callAction(TestAction::make('provideContact')->arguments([]), ['guest' => ['first_name' => 'Paul', 'last_name' => 'Telefon', 'email' => 'paul@example.org', 'street' => 'Strandweg 1', 'postal_code' => '18225', 'city' => 'Kühlungsborn', 'country' => 'DE'], 'process' => ProvideGuestContact::AUTOMATIC, 'guest_confirmed' => false])
->assertNotified('Kontaktdaten gespeichert, Angebot gesendet');
$this->assertSame(BookingStatus::OfferSent, $booking->fresh()->status);
@@ -202,7 +202,7 @@ public function test_nationality_is_never_a_reason_to_stop(): void
$foreign = app(CreateReservation::class)->handle(
$this->property->fresh(),
new StayRequest(CarbonImmutable::parse('2026-11-07'), CarbonImmutable::parse('2026-11-10'), 2),
['first_name' => 'Ayşe', 'last_name' => 'Yılmaz', 'email' => 'ayse@example.com.tr', 'country' => 'TR', 'city' => 'İzmir'],
['first_name' => 'Ayşe', 'last_name' => 'Yılmaz', 'email' => 'ayse@example.com.tr', 'country' => 'TR', 'city' => 'İzmir', 'street' => 'Strandweg 1', 'postal_code' => '18225', 'city' => 'Kühlungsborn', 'country' => 'DE'],
);
$this->assertSame(BookingStatus::OfferSent, $foreign->status);
@@ -243,7 +243,7 @@ private function request(string $email = 'gesa@example.org', bool $sendMails = f
return app(CreateReservation::class)->handle(
$this->property->fresh(),
new StayRequest(CarbonImmutable::parse('2026-11-07'), CarbonImmutable::parse('2026-11-10'), 2),
['first_name' => 'Gesa', 'last_name' => 'Gast', 'email' => $email],
['first_name' => 'Gesa', 'last_name' => 'Gast', 'email' => $email, 'street' => 'Strandweg 1', 'postal_code' => '18225', 'city' => 'Kühlungsborn', 'country' => 'DE'],
sendMails: $sendMails,
);
}
+1 -1
View File
@@ -62,7 +62,7 @@ public function test_every_mail_along_the_booking_path_renders_in_its_state(): v
$booking = app(CreateReservation::class)->handle(
Property::sole(),
new StayRequest(CarbonImmutable::parse('2026-12-01'), CarbonImmutable::parse('2026-12-05'), 2),
['first_name' => 'Erika', 'last_name' => 'Muster', 'email' => 'erika@example.com', 'street' => 'Seeweg 1', 'postal_code' => '18225', 'city' => 'Kühlungsborn'],
['first_name' => 'Erika', 'last_name' => 'Muster', 'email' => 'erika@example.com', 'street' => 'Seeweg 1', 'postal_code' => '18225', 'city' => 'Kühlungsborn', 'country' => 'DE'],
'Wir kommen mit Hund – ist das in Ordnung?',
sendMails: false,
);
+1 -1
View File
@@ -108,7 +108,7 @@ public function test_real_guest_mails_of_the_booking_process_go_to_the_test_reci
$property->tenant->update(['operating_mode' => Settings::MODE_TEST, 'test_recipient' => 'test@example.com']);
app(TenantContext::class)->set($property->tenant->fresh());
$booking = app(CreateReservation::class)->handle($property, new StayRequest(CarbonImmutable::parse('2026-11-07'), CarbonImmutable::parse('2026-11-10'), 2), ['first_name' => 'Gesa', 'last_name' => 'Gast', 'email' => 'gesa@gast.example']);
$booking = app(CreateReservation::class)->handle($property, new StayRequest(CarbonImmutable::parse('2026-11-07'), CarbonImmutable::parse('2026-11-10'), 2), ['first_name' => 'Gesa', 'last_name' => 'Gast', 'email' => 'gesa@gast.example', 'street' => 'Strandweg 1', 'postal_code' => '18225', 'city' => 'Kühlungsborn', 'country' => 'DE']);
app(SendOffer::class)->handle($booking);
$sent = $this->sent();
@@ -106,7 +106,7 @@ public function test_t23_every_message_goes_only_to_the_test_address_over_real_s
$property = Property::sole();
// Automatic: request → information; guest: booking wish → confirmation; scheduled: arrival information.
$booking = app(CreateReservation::class)->handle($property, new StayRequest(CarbonImmutable::parse('2026-11-07'), CarbonImmutable::parse('2026-11-10'), 2), ['first_name' => 'Gesa', 'last_name' => 'Gast', 'email' => self::GUEST]);
$booking = app(CreateReservation::class)->handle($property, new StayRequest(CarbonImmutable::parse('2026-11-07'), CarbonImmutable::parse('2026-11-10'), 2), ['first_name' => 'Gesa', 'last_name' => 'Gast', 'email' => self::GUEST, 'street' => 'Strandweg 1', 'postal_code' => '18225', 'city' => 'Kühlungsborn', 'country' => 'DE']);
$booking->refresh();
$this->post(URL::temporarySignedRoute('information.wish', $booking->information_valid_until, ['booking' => $booking, 'v' => $booking->information_version]), ['terms' => '1'])->assertRedirect();
$this->assertTrue($booking->fresh()->isBinding());
@@ -114,7 +114,7 @@ public function test_t23_every_message_goes_only_to_the_test_address_over_real_s
app(SendBookingReminders::class)->handle();
// Manual: the landlord resends the information of a second request; with Cc and Bcc to outside addresses.
$second = app(CreateReservation::class)->handle($property, new StayRequest(CarbonImmutable::parse('2026-11-21'), CarbonImmutable::parse('2026-11-24'), 2), ['first_name' => 'Ole', 'last_name' => 'Zweit', 'email' => 'ole@gast.example']);
$second = app(CreateReservation::class)->handle($property, new StayRequest(CarbonImmutable::parse('2026-11-21'), CarbonImmutable::parse('2026-11-24'), 2), ['first_name' => 'Ole', 'last_name' => 'Zweit', 'email' => 'ole@gast.example', 'street' => 'Strandweg 1', 'postal_code' => '18225', 'city' => 'Kühlungsborn', 'country' => 'DE']);
Livewire::test(ViewBooking::class, ['record' => $second->getRouteKey()])->callAction(TestAction::make('sendInformation')->arguments([]), ['acknowledged' => true])->assertNotified('Auskunft gesendet');
Mail::to('ole@gast.example')->cc('cc@aussen.example')->bcc('bcc@aussen.example')->send(new BookingWishNotice($second->fresh(), 'pending'));