'contact@example.com']); Mail::fake(); $honeypot = new Honeypot(config('honeypot')); $response = $this->from('/de/kontakt')->post('/de/kontakt', [ 'name' => 'Test User', 'email' => 'user@example.com', 'message' => 'Hello there!', $honeypot->nameFieldName() => '', $honeypot->validFromFieldName() => (string) EncryptedTime::create(now()->subSeconds(5)), ]); $response->assertRedirect('/de/kontakt'); $response->assertSessionHas('success'); Mail::assertSent(ContactRequest::class); Mail::assertQueued(ContactConfirmation::class, function (ContactConfirmation $mail) { return $mail->hasTo('user@example.com'); }); } public function test_contact_form_blocks_spam_when_honeypot_filled(): void { Mail::fake(); $honeypot = new Honeypot(config('honeypot')); $response = $this->from('/de/kontakt')->post('/de/kontakt', [ 'name' => 'Spam Bot', 'email' => 'spam@example.com', 'message' => 'Spam message', $honeypot->nameFieldName() => 'filled', $honeypot->validFromFieldName() => (string) EncryptedTime::create(now()->subSeconds(5)), ]); $response->assertOk(); $response->assertContent(''); Mail::assertNothingSent(); } }