Frontend: Editorial-Relaunch der öffentlichen Strecke + Ausgaben-Routing
Öffentliche Seiten auf gemeinsames Editorial-Design (x-web.site-header/-footer,
Design-Tokens) und Ausgaben-Präfix /{edition}/ (de|en) umgestellt.
- Routing: neue Middleware SetEdition (Locale + URL::defaults), /{edition}-Gruppe
in routes/web.php, Root-Redirect auf /de, 301 für Legacy-.html-URLs,
Baseline-Default in AppServiceProvider.
- Neue URL-Schemata: /{edition}/press-release/{slug}, /{edition}/category/{slug}.
- Ausgabe = Sprache: DE/EN-Umschalter (Region/CH/AT entfernt); EditorialClock
und Livewire-Komponenten sprachdynamisch.
- Detail-, Kategorie- und Veröffentlichen-Seite mit echten Daten neu aufgebaut.
- Suche aktiviert: Volt-Komponente livewire/web/search (Titel/Text/Keywords +
Firma + Rubrik, Filter, Sortierung, Pagination, URL-Parameter q/category/sort).
- Rubriken-Navigation statt Übersichtsseite: Helper CategoryNavigation;
web/kategorien.blade.php + Route entfernt (Legacy-301).
- Tests: Edition-Routing, Kategorie-Seite/-Navigation, Detail, Veröffentlichen,
Suche, EditorialClock. Doku in "Echte öffentliche Unterseiten.md" aktualisiert.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
a0547208d3
commit
253141c6dc
64 changed files with 4457 additions and 2971 deletions
115
tests/Feature/Web/EditionRoutingTest.php
Normal file
115
tests/Feature/Web/EditionRoutingTest.php
Normal file
|
|
@ -0,0 +1,115 @@
|
|||
<?php
|
||||
|
||||
use App\Enums\Portal;
|
||||
use App\Models\Category;
|
||||
use App\Models\Company;
|
||||
use App\Models\PressRelease;
|
||||
use Tests\TestCase;
|
||||
|
||||
test('the bare root redirects to the default edition with a 301', function () {
|
||||
/** @var TestCase $this */
|
||||
$this->get('https://businessportal24.test/')
|
||||
->assertStatus(301)
|
||||
->assertRedirect('https://businessportal24.test/de');
|
||||
|
||||
$this->get('https://presseecho.test/')
|
||||
->assertStatus(301)
|
||||
->assertRedirect('https://presseecho.test/de');
|
||||
});
|
||||
|
||||
test('both editions render the homepage', function () {
|
||||
/** @var TestCase $this */
|
||||
$this->get('https://businessportal24.test/de')->assertSuccessful();
|
||||
$this->get('https://businessportal24.test/en')->assertSuccessful();
|
||||
});
|
||||
|
||||
test('an unsupported edition prefix returns 404', function () {
|
||||
/** @var TestCase $this */
|
||||
$this->get('https://businessportal24.test/fr')->assertNotFound();
|
||||
});
|
||||
|
||||
test('legacy .html urls redirect to clean canonical urls with a 301', function () {
|
||||
/** @var TestCase $this */
|
||||
// Flache Detail-URL der Altseite -> /press-release/{slug}
|
||||
$this->get('https://businessportal24.test/de/steuerlast-spitzenverdiener.html')
|
||||
->assertStatus(301)
|
||||
->assertRedirect('https://businessportal24.test/de/press-release/steuerlast-spitzenverdiener');
|
||||
|
||||
// Kategorie behält ihren Pfad, nur .html fällt weg.
|
||||
$this->get('https://businessportal24.test/de/category/politik.html')
|
||||
->assertStatus(301)
|
||||
->assertRedirect('https://businessportal24.test/de/category/politik');
|
||||
|
||||
// Statische Seite behält ihren Pfad.
|
||||
$this->get('https://businessportal24.test/de/preise.html')
|
||||
->assertStatus(301)
|
||||
->assertRedirect('https://businessportal24.test/de/preise');
|
||||
|
||||
// Englische Ausgabe ebenso.
|
||||
$this->get('https://businessportal24.test/en/some-news.html')
|
||||
->assertStatus(301)
|
||||
->assertRedirect('https://businessportal24.test/en/press-release/some-news');
|
||||
});
|
||||
|
||||
test('a legacy .html url without an edition prefix lands on the default edition', function () {
|
||||
/** @var TestCase $this */
|
||||
$this->get('https://businessportal24.test/category/handel.html')
|
||||
->assertStatus(301)
|
||||
->assertRedirect('https://businessportal24.test/de/category/handel');
|
||||
});
|
||||
|
||||
test('the english edition only serves english content', function () {
|
||||
/** @var TestCase $this */
|
||||
$category = Category::factory()->create(['portal' => Portal::Both]);
|
||||
$category->translations()->create(['locale' => 'de', 'name' => 'Politik', 'slug' => 'politik']);
|
||||
$category->translations()->create(['locale' => 'en', 'name' => 'Politics', 'slug' => 'politics']);
|
||||
|
||||
$company = Company::factory()->businessportal24()->create(['name' => 'Global News AG']);
|
||||
|
||||
$german = PressRelease::factory()
|
||||
->published()
|
||||
->forPortal(Portal::Businessportal24)
|
||||
->for($category)
|
||||
->for($company)
|
||||
->create([
|
||||
'title' => 'Deutsche Meldung',
|
||||
'slug' => 'deutsche-meldung',
|
||||
'language' => 'de',
|
||||
'published_at' => now()->subDay(),
|
||||
]);
|
||||
|
||||
$english = PressRelease::factory()
|
||||
->published()
|
||||
->forPortal(Portal::Businessportal24)
|
||||
->for($category)
|
||||
->for($company)
|
||||
->create([
|
||||
'title' => 'English Story',
|
||||
'slug' => 'english-story',
|
||||
'language' => 'en',
|
||||
'published_at' => now()->subDay(),
|
||||
]);
|
||||
|
||||
// Englische Detailseite zeigt nur englische Meldungen.
|
||||
$this->get('https://businessportal24.test/en/press-release/'.$english->slug)
|
||||
->assertSuccessful()
|
||||
->assertSeeText('English Story');
|
||||
|
||||
$this->get('https://businessportal24.test/en/press-release/'.$german->slug)
|
||||
->assertNotFound();
|
||||
|
||||
// Deutsche Detailseite umgekehrt.
|
||||
$this->get('https://businessportal24.test/de/press-release/'.$german->slug)
|
||||
->assertSuccessful()
|
||||
->assertSeeText('Deutsche Meldung');
|
||||
|
||||
$this->get('https://businessportal24.test/de/press-release/'.$english->slug)
|
||||
->assertNotFound();
|
||||
|
||||
// Kategorie wird über den sprachspezifischen Slug aufgelöst.
|
||||
$this->get('https://businessportal24.test/en/category/politics')
|
||||
->assertSuccessful();
|
||||
|
||||
$this->get('https://businessportal24.test/en/category/politik')
|
||||
->assertNotFound();
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue