travelTo(CarbonImmutable::parse('2026-10-22 10:00')); $this->seed(PropertySeeder::class); Mail::fake(); } public function test_form_sent_faster_than_a_human_is_ignored_silently(): void { $this->filled('anna@example.com')->call('submit')->assertHasNoErrors(); $this->assertSame(0, Booking::count()); } public function test_honeypot_request_is_ignored(): void { $form = $this->filled('anna@example.com')->set('website', 'https://spam.example'); $this->travel(10)->seconds(); $form->call('submit'); $this->assertSame(0, Booking::count()); } public function test_human_request_after_a_few_seconds_is_accepted(): void { $form = $this->filled('anna@example.com'); $this->travel(10)->seconds(); $form->call('submit')->assertHasNoErrors()->assertSee('Vielen Dank, Anna!'); $this->assertSame(1, Booking::count()); } public function test_one_email_address_cannot_hold_many_dates_at_once(): void { foreach ([['2026-11-07', '2026-11-10'], ['2026-11-14', '2026-11-17'], ['2026-11-21', '2026-11-24']] as [$arrival, $departure]) { $form = $this->filled('anna@example.com', $arrival, $departure); $this->travel(10)->seconds(); $form->call('submit'); } $this->assertSame(2, Booking::count()); } public function test_links_in_names_or_many_links_in_the_message_are_rejected(): void { $form = $this->filled('anna@example.com')->set('firstName', 'Cheap https://pills.example')->set('message', 'see www.a.example and https://b.example'); $this->travel(10)->seconds(); $form->call('submit')->assertHasErrors(['firstName', 'message']); $this->assertSame(0, Booking::count()); } private function filled(string $email, string $arrival = '2026-11-07', string $departure = '2026-11-10'): Testable { return Livewire::test(BookingRequest::class) ->set('arrival', $arrival) ->set('departure', $departure) ->set('firstName', 'Anna') ->set('lastName', 'Muster') ->set('email', $email) ->set('privacyAccepted', true); } }