- GET kontakt/ueber-uns -> 301 auf die Ausgaben-Startseite; kontakt.store-POST bleibt fuer das Hub-Kontakt-Modal - Legacy-Aliases (contact/kontakt/ueber-uns) buendeln auf die Startseite - Spoke-Footer: Kontakt als mailto (Betreiber-Fallback bis R2.1), Ueber-uns-Link raus, Selfservice-Kuendigungslink ergaenzt - Sitemap-Konstanten bereinigt, Tests angepasst Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
94 lines
3.6 KiB
PHP
94 lines
3.6 KiB
PHP
<?php
|
|
|
|
use App\Mail\ContactRequestSubmitted;
|
|
use Illuminate\Support\Facades\Mail;
|
|
use Tests\TestCase;
|
|
|
|
test('the hub landing renders the contact modal form', function () {
|
|
/** @var TestCase $this */
|
|
// Die frühere Kontakt-Seite wurde zurückgebaut; das Formular lebt im
|
|
// Kontakt-Modal des Hubs und postet weiter auf kontakt.store.
|
|
$this->get('https://pressekonto.test/')
|
|
->assertSuccessful()
|
|
->assertSee('name="name"', false)
|
|
->assertSee('name="email"', false)
|
|
->assertSee('name="message"', false)
|
|
->assertSee('Nachricht senden');
|
|
});
|
|
|
|
test('a valid contact request sends a mail to the configured recipient', function () {
|
|
/** @var TestCase $this */
|
|
Mail::fake();
|
|
config()->set('domains.domains.businessportal24.brand.contact_email', 'redaktion@businessportal24.de');
|
|
|
|
$this->from('https://businessportal24.test/de')
|
|
->post('https://businessportal24.test/de/kontakt', [
|
|
'name' => 'Paula Presse',
|
|
'email' => 'paula@example.test',
|
|
'message' => 'Ich habe eine Frage zu Ihrer Plattform und bitte um Rückruf.',
|
|
])
|
|
->assertRedirect('https://businessportal24.test/de')
|
|
->assertSessionHas('contact-status');
|
|
|
|
Mail::assertSent(ContactRequestSubmitted::class, function (ContactRequestSubmitted $mail) {
|
|
return $mail->hasTo('redaktion@businessportal24.de')
|
|
&& $mail->hasReplyTo('paula@example.test')
|
|
&& $mail->senderName === 'Paula Presse';
|
|
});
|
|
});
|
|
|
|
test('without a configured brand address the mail falls back to the from address', function () {
|
|
/** @var TestCase $this */
|
|
Mail::fake();
|
|
config()->set('domains.domains.businessportal24.brand.contact_email', null);
|
|
config()->set('mail.from.address', 'fallback@pressekonto.de');
|
|
|
|
$this->post('https://businessportal24.test/de/kontakt', [
|
|
'name' => 'Paula Presse',
|
|
'email' => 'paula@example.test',
|
|
'message' => 'Ich habe eine Frage zu Ihrer Plattform und bitte um Rückruf.',
|
|
])->assertSessionHas('contact-status');
|
|
|
|
Mail::assertSent(ContactRequestSubmitted::class, fn (ContactRequestSubmitted $mail) => $mail->hasTo('fallback@pressekonto.de'));
|
|
});
|
|
|
|
test('a contact request from the hub domain goes to the pressekonto brand address', function () {
|
|
/** @var TestCase $this */
|
|
Mail::fake();
|
|
config()->set('domains.domains.pressekonto.brand.contact_email', 'kontakt@pressekonto.de');
|
|
|
|
$this->post('https://pressekonto.test/de/kontakt', [
|
|
'name' => 'Paula Presse',
|
|
'email' => 'paula@example.test',
|
|
'message' => 'Ich habe eine Frage zu Ihrer Plattform und bitte um Rückruf.',
|
|
])->assertSessionHas('contact-status');
|
|
|
|
Mail::assertSent(ContactRequestSubmitted::class, fn (ContactRequestSubmitted $mail) => $mail->hasTo('kontakt@pressekonto.de'));
|
|
});
|
|
|
|
test('honeypot submissions are silently accepted without sending mail', function () {
|
|
/** @var TestCase $this */
|
|
Mail::fake();
|
|
|
|
$this->post('https://businessportal24.test/de/kontakt', [
|
|
'name' => 'Bot',
|
|
'email' => 'bot@example.test',
|
|
'message' => 'Automatisierter Inhalt mit ausreichend Länge für die Validierung.',
|
|
'website' => 'https://spam.example',
|
|
])->assertSessionHas('contact-status');
|
|
|
|
Mail::assertNothingSent();
|
|
});
|
|
|
|
test('the contact form validates its inputs', function () {
|
|
/** @var TestCase $this */
|
|
Mail::fake();
|
|
|
|
$this->post('https://businessportal24.test/de/kontakt', [
|
|
'name' => '',
|
|
'email' => 'keine-mail',
|
|
'message' => 'kurz',
|
|
])->assertSessionHasErrors(['name', 'email', 'message']);
|
|
|
|
Mail::assertNothingSent();
|
|
});
|