presseportale/tests/Feature/Web/PressekontoHubHomeTest.php
Kevin Adametz fd8e050cb7 Backend-WIP: Kontakt-Queue, Page-Cache, Validierungs-Feedback, i18n
Gebuendelt, da ueber gemeinsame lang-/Service-Dateien verschraenkt:
- Kontakt-Nachrichten: contact_messages-Tabelle + Model/Enums/Factory,
  Admin-Queue (livewire/admin/contact-messages), ContactController
  persistiert das Anliegen zusaetzlich zur Brand-Mail
- Page-Data-Cache (Services/Web/*PageData) + web-archive-Indizes auf
  press_releases
- Validierungs-Feedback + Company-Portal-Restriction (Feature-Tests)
- i18n-Auslagerung lang/de|en (auth, passwords, validation, static)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-09 15:38:11 +00:00

193 lines
7.2 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
use App\Models\User;
use Database\Seeders\PlanSeeder;
use Database\Seeders\RolesAndPermissionsSeeder;
use Tests\TestCase;
test('pressekonto hub homepage renders the publisher landing shell', function () {
/** @var TestCase $this */
$this->seed(PlanSeeder::class);
$this->get('https://pressekonto.test/')
->assertSuccessful()
->assertSee('presse', false)
->assertSee('konto', false)
->assertSeeText('Publisher-Hub')
->assertSeeText('Ein Konto.')
->assertSeeText('Was Sie hier können')
->assertSeeText('So funktioniert es')
->assertSeeText('Vier Schritte')
->assertSeeText('Tarife')
->assertSeeText('Enterprise')
->assertSeeText('Hinter pressekonto')
->assertSeeText('Die Plattform in Zahlen')
->assertSeeText('Plattform im Überblick')
->assertSeeText('Häufige Fragen')
->assertSeeText('Loslegen');
});
test('pressekonto hub pricing is driven by the plan catalog', function () {
/** @var TestCase $this */
$this->seed(PlanSeeder::class);
$response = $this->get('https://pressekonto.test/')->assertSuccessful();
// Alle aktiven Tarife aus dem Katalog inkl. Kontingent; die frühere
// hartcodierte Fake-Preisliste (0/49/149 €, "Standard") ist raus.
$response
->assertSeeText('Starter')
->assertSeeText('Business')
->assertSeeText('Pro')
->assertSeeText('Agency')
->assertSee('29&nbsp;€', false)
->assertSee('199&nbsp;€', false)
->assertDontSeeText('Standard')
->assertDontSee('149&nbsp;€', false);
});
test('pressekonto hub homepage has no dead links or fabricated references', function () {
/** @var TestCase $this */
$this->seed(PlanSeeder::class);
$response = $this->get('https://pressekonto.test/')->assertSuccessful();
$content = $response->getContent();
expect($content)
->not->toContain('href="#"')
->not->toContain('Siemens')
->not->toContain('Alle Systeme betriebsbereit')
->not->toContain('14 Tage')
->not->toContain('ISO 27001');
// Rechtsseiten sind auf der Hub-Domain verlinkt und erreichbar.
expect($content)->toContain('/de/impressum')->toContain('/de/datenschutz');
});
test('a logged-in user sees the panel link instead of the auth buttons', function () {
/** @var TestCase $this */
$this->seed(RolesAndPermissionsSeeder::class);
$customer = User::factory()->create(['is_active' => true, 'email_verified_at' => now()]);
$customer->assignRole('customer');
$this->actingAs($customer)
->get('https://pressekonto.test/')
->assertSuccessful()
->assertSeeText('Zum pressekonto')
->assertSee('/admin/me', false)
->assertDontSeeText('Konto erstellen')
->assertDontSeeText('Anmelden');
});
test('the hub exposes a contact modal instead of a mailto address', function () {
/** @var TestCase $this */
$response = $this->get('https://pressekonto.test/')->assertSuccessful();
$content = $response->getContent();
// Spam-Schutz: keine E-Mail-Adresse im Quelltext, stattdessen das Modal-Formular.
expect($content)
->not->toContain('mailto:')
->toContain('open-contact-modal')
->toContain('action="'.route('kontakt.store', ['edition' => 'de']).'"')
->toContain('name="website"');
});
test('the hub page speaks of Pruefung without the redaktionell qualifier', function () {
/** @var TestCase $this */
$this->get('https://pressekonto.test/')
->assertSuccessful()
->assertDontSeeText('Redaktionelle Prüfung')
->assertDontSeeText('redaktionelle Prüfung')
->assertSeeText('Prüfung inklusive');
});
test('the hub links faq and help center in header and footer', function () {
/** @var TestCase $this */
$this->seed(PlanSeeder::class);
$response = $this->get('https://pressekonto.test/')->assertSuccessful();
$content = $response->getContent();
// FAQ + Hilfe sind in der Top-Utility-Bar (neben Kontakt) und im
// Footer unter „Plattform" verlinkt.
expect($content)
->toContain('/de/faq')
->toContain('/de/hilfe')
->toContain('Hilfe-Center');
// Beide Ziele sind auf der Hub-Domain erreichbar.
$this->get('https://pressekonto.test/de/faq')->assertSuccessful();
$this->get('https://pressekonto.test/de/hilfe')->assertSuccessful();
});
test('legal pages are reachable on the hub domain', function () {
/** @var TestCase $this */
$this->get('https://pressekonto.test/de/impressum')->assertSuccessful();
$this->get('https://pressekonto.test/de/datenschutz')->assertSuccessful();
$this->get('https://pressekonto.test/de/agb')->assertSuccessful();
// Cookie-Seite zurückgebaut — Inhalte stehen in der Datenschutzerklärung.
$this->get('https://pressekonto.test/de/cookies')
->assertStatus(301)
->assertRedirect('https://pressekonto.test/de/datenschutz');
});
test('pressekonto hub homepage uses the brand-mark splitting without TLDs', function () {
/** @var TestCase $this */
$response = $this->get('https://pressekonto.test/');
$content = $response->getContent();
$response->assertSuccessful();
// Markennamen erscheinen ausschliesslich gesplittet (presse|echo, businessportal|24, presse|konto).
expect($content)
->not->toContain('presseecho.de')
->not->toContain('businessportal24.com')
->toContain('businessportal')
->toContain('>24<')
->toContain('>echo<')
->toContain('>konto<');
// pressekonto darf als Domain nirgends im Lese-Text auftauchen — nur die
// gesplittete Marken-Schreibweise.
expect($content)->not->toContain('pressekonto.de');
});
test('pressekonto hub homepage loads the hub theme assets, not portal admin', function () {
/** @var TestCase $this */
$response = $this->get('https://pressekonto.test/');
$response
->assertSuccessful()
->assertSee('theme-pressekonto', false)
->assertDontSee('theme-businessportal24', false)
->assertDontSee('theme-presseecho', false);
});
test('pressekonto hub homepage hides the brand-context banner without a from parameter', function () {
/** @var TestCase $this */
$this->get('https://pressekonto.test/')
->assertSuccessful()
->assertDontSeeText('Sie kommen von');
});
test('pressekonto hub homepage shows the brand-context banner when arriving from presseecho', function () {
/** @var TestCase $this */
$response = $this->get('https://pressekonto.test/?from=presseecho')
->assertSuccessful()
->assertSeeText('Sie kommen von')
->assertSeeText('Zurück zu');
// Brand-Mark rendert "presse" + farbiger Akzent "echo" – TLD darf nicht auftauchen.
$response->assertDontSee('presseecho.de', false);
});
test('pressekonto hub homepage shows the brand-context banner when arriving from businessportal24', function () {
/** @var TestCase $this */
$response = $this->get('https://pressekonto.test/?from=businessportal24')
->assertSuccessful()
->assertSeeText('Sie kommen von')
->assertSeeText('Zurück zu');
$response->assertDontSee('businessportal24.com', false);
});