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
57afcab3b9
commit
3a1d2e6751
64 changed files with 4457 additions and 2971 deletions
|
|
@ -9,7 +9,7 @@ use Tests\TestCase;
|
|||
|
||||
test('businessportal24 homepage renders the editorial shell', function () {
|
||||
/** @var TestCase $this */
|
||||
$this->get('https://businessportal24.test/')
|
||||
$this->get('https://businessportal24.test/de')
|
||||
->assertSuccessful()
|
||||
->assertSee('businessportal', false)
|
||||
->assertSeeText('Pressemitteilungen · DACH')
|
||||
|
|
@ -20,7 +20,6 @@ test('businessportal24 homepage renders the editorial shell', function () {
|
|||
->assertSeeText('Veröffentlichen Sie Ihre Pressemitteilung')
|
||||
->assertSeeText('Redaktioneller Qualitätsstandard')
|
||||
->assertSeeText('AD-HOC')
|
||||
->assertSeeText('Termine & Events')
|
||||
->assertSeeText('Branchen-Index')
|
||||
->assertSeeText('Heute im Fokus')
|
||||
->assertSee('businessportal', false)
|
||||
|
|
@ -89,7 +88,7 @@ test('businessportal24 homepage feed only shows published businessportal content
|
|||
'published_at' => now()->subDay(),
|
||||
]);
|
||||
|
||||
$this->get('https://businessportal24.test/')
|
||||
$this->get('https://businessportal24.test/de')
|
||||
->assertSuccessful()
|
||||
->assertSeeText('BusinessPortal24 sichtbare Meldung')
|
||||
->assertSeeText('Gemeinsame sichtbare Meldung')
|
||||
|
|
@ -136,7 +135,7 @@ test('businessportal24 homepage shows most read releases in the sidebar', functi
|
|||
'published_at' => now()->subDays(2),
|
||||
]);
|
||||
|
||||
$this->get('https://businessportal24.test/')
|
||||
$this->get('https://businessportal24.test/de')
|
||||
->assertSuccessful()
|
||||
->assertSeeText('Meistgelesen')
|
||||
->assertSeeText('Meistgelesene BP24-Meldung')
|
||||
|
|
|
|||
|
|
@ -1,20 +1,36 @@
|
|||
<?php
|
||||
|
||||
use App\Enums\Portal;
|
||||
use App\Models\Category;
|
||||
use App\Models\Company;
|
||||
use App\Models\PressRelease;
|
||||
use Tests\TestCase;
|
||||
|
||||
test('the release detail page emits an article canonical from its slug', function () {
|
||||
/** @var TestCase $this */
|
||||
$this->get('https://businessportal24.test/release/ki-revolution')
|
||||
$category = Category::factory()->create(['portal' => Portal::Businessportal24]);
|
||||
$category->translations()->create(['locale' => 'de', 'name' => 'Technologie', 'slug' => 'technologie']);
|
||||
|
||||
$company = Company::factory()->businessportal24()->create();
|
||||
|
||||
PressRelease::factory()
|
||||
->published()
|
||||
->forPortal(Portal::Businessportal24)
|
||||
->for($category)
|
||||
->for($company)
|
||||
->create(['slug' => 'ki-revolution', 'published_at' => now()->subDay()]);
|
||||
|
||||
$this->get('https://businessportal24.test/de/press-release/ki-revolution')
|
||||
->assertSuccessful()
|
||||
->assertSee('<link rel="canonical" href="', false)
|
||||
->assertSee('/release/ki-revolution', false)
|
||||
->assertSee('/de/press-release/ki-revolution', false)
|
||||
->assertSee('<meta property="og:type" content="article">', false)
|
||||
->assertSee('<meta property="og:url" content="', false);
|
||||
});
|
||||
|
||||
test('a portal homepage emits a self-referencing canonical for its own domain', function () {
|
||||
/** @var TestCase $this */
|
||||
$this->get('https://businessportal24.test/')
|
||||
$this->get('https://businessportal24.test/de')
|
||||
->assertSuccessful()
|
||||
->assertSee('<link rel="canonical" href="https://businessportal24.test', false)
|
||||
->assertSee('<meta property="og:site_name" content="', false);
|
||||
|
|
@ -22,7 +38,7 @@ test('a portal homepage emits a self-referencing canonical for its own domain',
|
|||
|
||||
test('portals stay self-canonical on their own host, never cross-portal', function () {
|
||||
/** @var TestCase $this */
|
||||
$this->get('https://presseecho.test/')
|
||||
$this->get('https://presseecho.test/de')
|
||||
->assertSuccessful()
|
||||
->assertSee('<link rel="canonical" href="https://presseecho.test', false)
|
||||
->assertDontSee('businessportal24.test', false);
|
||||
|
|
|
|||
53
tests/Feature/Web/CategoryNavigationTest.php
Normal file
53
tests/Feature/Web/CategoryNavigationTest.php
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
<?php
|
||||
|
||||
use App\Enums\Portal;
|
||||
use App\Models\Category;
|
||||
use App\Models\PressRelease;
|
||||
use Tests\TestCase;
|
||||
|
||||
function seedNavigationCategory(string $name, string $slug): Category
|
||||
{
|
||||
$category = Category::factory()->create(['portal' => Portal::Both, 'is_active' => true]);
|
||||
$category->translations()->create(['locale' => 'de', 'name' => $name, 'slug' => $slug]);
|
||||
|
||||
PressRelease::factory()
|
||||
->published()
|
||||
->forPortal(Portal::Businessportal24)
|
||||
->for($category)
|
||||
->create(['language' => 'de', 'published_at' => now()->subDay()]);
|
||||
|
||||
return $category;
|
||||
}
|
||||
|
||||
test('the header navigation lists real categories that link to their category page', function () {
|
||||
/** @var TestCase $this */
|
||||
seedNavigationCategory('Energie & Klima', 'energie-klima');
|
||||
|
||||
$this->get('https://businessportal24.test/de')
|
||||
->assertSuccessful()
|
||||
->assertSee('/de/category/energie-klima', false)
|
||||
->assertSeeText('Energie & Klima');
|
||||
});
|
||||
|
||||
test('there is no standalone category overview page anymore', function () {
|
||||
/** @var TestCase $this */
|
||||
$this->get('https://businessportal24.test/de/kategorien')->assertNotFound();
|
||||
});
|
||||
|
||||
test('a legacy category overview url redirects to the edition home', function () {
|
||||
/** @var TestCase $this */
|
||||
$this->get('https://businessportal24.test/de/kategorien.html')
|
||||
->assertRedirect('https://businessportal24.test/de');
|
||||
|
||||
$this->get('https://businessportal24.test/kategorien.html')
|
||||
->assertRedirect('https://businessportal24.test/de');
|
||||
});
|
||||
|
||||
test('the navigation marks the active category on its own page', function () {
|
||||
/** @var TestCase $this */
|
||||
seedNavigationCategory('Mobilität', 'mobilitaet');
|
||||
|
||||
$this->get('https://businessportal24.test/de/category/mobilitaet')
|
||||
->assertSuccessful()
|
||||
->assertSee('/de/category/mobilitaet', false);
|
||||
});
|
||||
79
tests/Feature/Web/CategoryPageTest.php
Normal file
79
tests/Feature/Web/CategoryPageTest.php
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
<?php
|
||||
|
||||
use App\Enums\Portal;
|
||||
use App\Models\Category;
|
||||
use App\Models\Company;
|
||||
use App\Models\PressRelease;
|
||||
use Tests\TestCase;
|
||||
|
||||
function makeCategory(Portal $portal, string $name, string $slug): Category
|
||||
{
|
||||
$category = Category::factory()->create(['portal' => $portal]);
|
||||
$category->translations()->create([
|
||||
'locale' => 'de',
|
||||
'name' => $name,
|
||||
'slug' => $slug,
|
||||
'description' => 'Testbeschreibung für '.$name.'.',
|
||||
]);
|
||||
|
||||
return $category;
|
||||
}
|
||||
|
||||
test('businessportal24 category page renders the editorial shell with real data', function () {
|
||||
/** @var TestCase $this */
|
||||
$category = makeCategory(Portal::Both, 'Energie & Klima', 'energie-klima');
|
||||
|
||||
$company = Company::factory()->businessportal24()->create([
|
||||
'name' => 'Nordwind Energie AG',
|
||||
]);
|
||||
|
||||
foreach (range(0, 3) as $i) {
|
||||
PressRelease::factory()
|
||||
->published()
|
||||
->forPortal(Portal::Businessportal24)
|
||||
->for($category)
|
||||
->for($company)
|
||||
->create([
|
||||
'title' => "Energie Branchenmeldung {$i}",
|
||||
'slug' => "energie-branchenmeldung-{$i}",
|
||||
'hits' => 100 * ($i + 1),
|
||||
'published_at' => now()->subDays($i + 1),
|
||||
]);
|
||||
}
|
||||
|
||||
$this->get('https://businessportal24.test/de/category/energie-klima')
|
||||
->assertSuccessful()
|
||||
->assertSeeText('Energie & Klima')
|
||||
->assertSeeText('Aktuelle Meldungen')
|
||||
->assertSeeText('Energie Branchenmeldung 0')
|
||||
->assertSeeText('Nordwind Energie AG')
|
||||
->assertSeeText('Meistgelesen');
|
||||
});
|
||||
|
||||
test('category page returns 404 for unknown and inactive categories', function () {
|
||||
/** @var TestCase $this */
|
||||
$this->get('https://businessportal24.test/de/category/gibt-es-nicht')->assertNotFound();
|
||||
|
||||
$inactive = Category::factory()->create(['portal' => Portal::Both, 'is_active' => false]);
|
||||
$inactive->translations()->create(['locale' => 'de', 'name' => 'Versteckt', 'slug' => 'versteckt']);
|
||||
|
||||
$this->get('https://businessportal24.test/de/category/versteckt')->assertNotFound();
|
||||
});
|
||||
|
||||
test('category page does not expose categories from another portal', function () {
|
||||
/** @var TestCase $this */
|
||||
$category = makeCategory(Portal::Presseecho, 'Nur Presseecho', 'nur-presseecho');
|
||||
|
||||
PressRelease::factory()
|
||||
->published()
|
||||
->forPortal(Portal::Presseecho)
|
||||
->for($category)
|
||||
->for(Company::factory()->presseecho())
|
||||
->create(['slug' => 'pe-branchenmeldung', 'published_at' => now()->subDay()]);
|
||||
|
||||
$this->get('https://businessportal24.test/de/category/nur-presseecho')->assertNotFound();
|
||||
|
||||
$this->get('https://presseecho.test/de/category/nur-presseecho')
|
||||
->assertSuccessful()
|
||||
->assertSeeText('Nur Presseecho');
|
||||
});
|
||||
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();
|
||||
});
|
||||
52
tests/Feature/Web/HomeEditorialClockTest.php
Normal file
52
tests/Feature/Web/HomeEditorialClockTest.php
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
<?php
|
||||
|
||||
use App\Enums\Portal;
|
||||
use App\Models\Category;
|
||||
use App\Models\Company;
|
||||
use App\Models\PressRelease;
|
||||
use Tests\TestCase;
|
||||
|
||||
test('homepage anchors recency to the latest release so spotlight, newsrooms and ticker use real data', function () {
|
||||
/** @var TestCase $this */
|
||||
$category = Category::factory()->create([
|
||||
'portal' => Portal::Both,
|
||||
]);
|
||||
$category->translations()->create([
|
||||
'locale' => 'de',
|
||||
'name' => 'Energie & Klima',
|
||||
'slug' => 'energie-klima',
|
||||
]);
|
||||
|
||||
$company = Company::factory()->businessportal24()->create([
|
||||
'name' => 'Nordwind Energie AG',
|
||||
]);
|
||||
|
||||
// Historisches Archiv: jüngster Datensatz liegt 40 Tage in der Vergangenheit.
|
||||
$anchor = now()->subDays(40);
|
||||
|
||||
foreach (range(0, 2) as $i) {
|
||||
PressRelease::factory()
|
||||
->published()
|
||||
->forPortal(Portal::Businessportal24)
|
||||
->for($category)
|
||||
->for($company)
|
||||
->create([
|
||||
'title' => "Echte Spotlight Meldung {$i}",
|
||||
'slug' => "echte-spotlight-meldung-{$i}",
|
||||
'published_at' => $anchor->copy()->subDays($i),
|
||||
]);
|
||||
}
|
||||
|
||||
$this->get('https://businessportal24.test/de')
|
||||
->assertSuccessful()
|
||||
// Aktive Newsrooms zeigt echte Firma statt Mock.
|
||||
->assertSeeText('Nordwind Energie AG')
|
||||
->assertDontSeeText('Siemens AG')
|
||||
// Heute im Fokus + Branchen-Index nutzen echte Rubrik.
|
||||
->assertSeeText('Energie & Klima')
|
||||
// Spotlight + Feed zeigen echte Meldungen statt Mock.
|
||||
->assertSeeText('Echte Spotlight Meldung 0')
|
||||
->assertDontSeeText('RWE AG')
|
||||
// Ad-Hoc-Ticker zeigt keine Mock-Meldungen mehr.
|
||||
->assertDontSeeText('Siemens Energy hebt Jahresprognose an');
|
||||
});
|
||||
|
|
@ -9,7 +9,7 @@ use Tests\TestCase;
|
|||
|
||||
test('presseecho homepage renders the editorial shell', function () {
|
||||
/** @var TestCase $this */
|
||||
$this->get('https://presseecho.test/')
|
||||
$this->get('https://presseecho.test/de')
|
||||
->assertSuccessful()
|
||||
->assertSee('presseecho', false)
|
||||
->assertSeeText('Pressemitteilungen · DACH')
|
||||
|
|
@ -20,7 +20,6 @@ test('presseecho homepage renders the editorial shell', function () {
|
|||
->assertSeeText('Veröffentlichen Sie Ihre Pressemitteilung')
|
||||
->assertSeeText('Redaktioneller Qualitätsstandard')
|
||||
->assertSeeText('AD-HOC')
|
||||
->assertSeeText('Termine & Events')
|
||||
->assertSeeText('Branchen-Index')
|
||||
->assertSeeText('Heute im Fokus');
|
||||
});
|
||||
|
|
@ -84,7 +83,7 @@ test('presseecho homepage feed only shows published presseecho content', functio
|
|||
'published_at' => now()->subDay(),
|
||||
]);
|
||||
|
||||
$this->get('https://presseecho.test/')
|
||||
$this->get('https://presseecho.test/de')
|
||||
->assertSuccessful()
|
||||
->assertSeeText('Presseecho sichtbare Meldung')
|
||||
->assertSeeText('Gemeinsame sichtbare Meldung')
|
||||
|
|
@ -131,7 +130,7 @@ test('presseecho homepage shows most read releases in the sidebar', function ()
|
|||
'published_at' => now()->subDays(2),
|
||||
]);
|
||||
|
||||
$this->get('https://presseecho.test/')
|
||||
$this->get('https://presseecho.test/de')
|
||||
->assertSuccessful()
|
||||
->assertSeeText('Meistgelesen')
|
||||
->assertSeeText('Meistgelesene Presseecho-Meldung')
|
||||
|
|
|
|||
169
tests/Feature/Web/ReleaseDetailTest.php
Normal file
169
tests/Feature/Web/ReleaseDetailTest.php
Normal file
|
|
@ -0,0 +1,169 @@
|
|||
<?php
|
||||
|
||||
use App\Enums\Portal;
|
||||
use App\Enums\PressReleaseStatus;
|
||||
use App\Models\Category;
|
||||
use App\Models\Company;
|
||||
use App\Models\Contact;
|
||||
use App\Models\PressRelease;
|
||||
use Tests\TestCase;
|
||||
|
||||
/**
|
||||
* @return array{0: Category, 1: Company}
|
||||
*/
|
||||
function detailCategoryAndCompany(Portal $portal): array
|
||||
{
|
||||
$category = Category::factory()->create(['portal' => $portal]);
|
||||
$category->translations()->create([
|
||||
'locale' => 'de',
|
||||
'name' => 'Energie & Klima',
|
||||
'slug' => 'energie-klima',
|
||||
]);
|
||||
|
||||
$company = Company::factory()->create([
|
||||
'portal' => $portal,
|
||||
'name' => 'Muster Energie GmbH',
|
||||
'is_active' => true,
|
||||
'website' => 'https://muster-energie.de',
|
||||
'boilerplate' => 'Die Muster Energie GmbH ist ein Spezialist für Industrie-Dekarbonisierung.',
|
||||
]);
|
||||
|
||||
return [$category, $company];
|
||||
}
|
||||
|
||||
test('businessportal24 release detail renders the editorial shell with real data', function () {
|
||||
/** @var TestCase $this */
|
||||
[$category, $company] = detailCategoryAndCompany(Portal::Businessportal24);
|
||||
|
||||
$release = PressRelease::factory()
|
||||
->published()
|
||||
->forPortal(Portal::Businessportal24)
|
||||
->for($category)
|
||||
->for($company)
|
||||
->create([
|
||||
'title' => 'Energiewende 2030: 12-Milliarden-Programm angekündigt',
|
||||
'subtitle' => 'Erste Tranche fließt ab dem dritten Quartal 2026.',
|
||||
'slug' => 'energiewende-2030-programm',
|
||||
'text' => '<p>Berlin. Das Programm beschleunigt die Dekarbonisierung der Schwerindustrie.</p>',
|
||||
'keywords' => 'Energiewende, Dekarbonisierung, Wasserstoff',
|
||||
'published_at' => now()->subDay(),
|
||||
]);
|
||||
|
||||
$contact = Contact::factory()->create([
|
||||
'portal' => Portal::Businessportal24,
|
||||
'company_id' => $company->id,
|
||||
'first_name' => 'Annika',
|
||||
'last_name' => 'Werthmann',
|
||||
'email' => 'presse@muster-energie.de',
|
||||
]);
|
||||
$release->contacts()->attach($contact);
|
||||
|
||||
$this->get('https://businessportal24.test/de/press-release/'.$release->slug)
|
||||
->assertSuccessful()
|
||||
->assertSee('businessportal', false)
|
||||
->assertSeeText('Energiewende 2030: 12-Milliarden-Programm angekündigt')
|
||||
->assertSeeText('Erste Tranche fließt ab dem dritten Quartal 2026.')
|
||||
->assertSeeText('Muster Energie GmbH')
|
||||
->assertSeeText('Energie & Klima')
|
||||
->assertSeeText('Pressekontakt')
|
||||
->assertSeeText('Annika Werthmann')
|
||||
->assertSeeText('Dekarbonisierung der Schwerindustrie')
|
||||
->assertSeeText('Über das Unternehmen')
|
||||
->assertSeeText('Wasserstoff');
|
||||
});
|
||||
|
||||
test('release detail counts a hit', function () {
|
||||
/** @var TestCase $this */
|
||||
[$category, $company] = detailCategoryAndCompany(Portal::Businessportal24);
|
||||
|
||||
$release = PressRelease::factory()
|
||||
->published()
|
||||
->forPortal(Portal::Businessportal24)
|
||||
->for($category)
|
||||
->for($company)
|
||||
->create(['slug' => 'hit-zaehler', 'hits' => 4, 'published_at' => now()->subDay()]);
|
||||
|
||||
$this->get('https://businessportal24.test/de/press-release/'.$release->slug)->assertSuccessful();
|
||||
|
||||
expect(PressRelease::withoutGlobalScopes()->find($release->id)->hits)->toBe(5);
|
||||
});
|
||||
|
||||
test('release detail returns 404 for drafts and unknown slugs', function () {
|
||||
/** @var TestCase $this */
|
||||
[$category, $company] = detailCategoryAndCompany(Portal::Businessportal24);
|
||||
|
||||
$draft = PressRelease::factory()
|
||||
->forPortal(Portal::Businessportal24)
|
||||
->for($category)
|
||||
->for($company)
|
||||
->create([
|
||||
'status' => PressReleaseStatus::Draft,
|
||||
'slug' => 'noch-ein-entwurf',
|
||||
'published_at' => now()->subDay(),
|
||||
]);
|
||||
|
||||
$this->get('https://businessportal24.test/de/press-release/'.$draft->slug)->assertNotFound();
|
||||
$this->get('https://businessportal24.test/de/press-release/gibt-es-nicht')->assertNotFound();
|
||||
});
|
||||
|
||||
test('release detail does not expose releases from another portal', function () {
|
||||
/** @var TestCase $this */
|
||||
[$category, $company] = detailCategoryAndCompany(Portal::Presseecho);
|
||||
|
||||
$release = PressRelease::factory()
|
||||
->published()
|
||||
->forPortal(Portal::Presseecho)
|
||||
->for($category)
|
||||
->for($company)
|
||||
->create([
|
||||
'title' => 'Nur für presseecho sichtbar',
|
||||
'slug' => 'nur-presseecho',
|
||||
'published_at' => now()->subDay(),
|
||||
]);
|
||||
|
||||
$this->get('https://businessportal24.test/de/press-release/'.$release->slug)->assertNotFound();
|
||||
|
||||
$this->get('https://presseecho.test/de/press-release/'.$release->slug)
|
||||
->assertSuccessful()
|
||||
->assertSee('presse', false)
|
||||
->assertSeeText('Nur für presseecho sichtbar');
|
||||
});
|
||||
|
||||
test('release detail shows more from newsroom and related releases', function () {
|
||||
/** @var TestCase $this */
|
||||
[$category, $company] = detailCategoryAndCompany(Portal::Businessportal24);
|
||||
|
||||
$main = PressRelease::factory()
|
||||
->published()
|
||||
->forPortal(Portal::Businessportal24)
|
||||
->for($category)
|
||||
->for($company)
|
||||
->create(['title' => 'Hauptmeldung Energie', 'slug' => 'hauptmeldung-energie', 'published_at' => now()->subDay()]);
|
||||
|
||||
PressRelease::factory()
|
||||
->published()
|
||||
->forPortal(Portal::Businessportal24)
|
||||
->for($category)
|
||||
->for($company)
|
||||
->create(['title' => 'Weitere Meldung desselben Newsrooms', 'slug' => 'weitere-newsroom-meldung', 'published_at' => now()->subDays(2)]);
|
||||
|
||||
$otherCompany = Company::factory()->create([
|
||||
'portal' => Portal::Businessportal24,
|
||||
'name' => 'Andere Industrie AG',
|
||||
'is_active' => true,
|
||||
]);
|
||||
|
||||
PressRelease::factory()
|
||||
->published()
|
||||
->forPortal(Portal::Businessportal24)
|
||||
->for($category)
|
||||
->for($otherCompany)
|
||||
->create(['title' => 'Verwandte Branchenmeldung', 'slug' => 'verwandte-branchenmeldung', 'published_at' => now()->subDays(3)]);
|
||||
|
||||
$this->get('https://businessportal24.test/de/press-release/'.$main->slug)
|
||||
->assertSuccessful()
|
||||
->assertSeeText('Mehr von Muster Energie GmbH')
|
||||
->assertSeeText('Weitere Meldung desselben Newsrooms')
|
||||
->assertSeeText('Verwandte Meldungen')
|
||||
->assertSeeText('Verwandte Branchenmeldung');
|
||||
});
|
||||
85
tests/Feature/Web/SearchPageTest.php
Normal file
85
tests/Feature/Web/SearchPageTest.php
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
<?php
|
||||
|
||||
use App\Enums\Portal;
|
||||
use App\Models\Category;
|
||||
use App\Models\Company;
|
||||
use App\Models\PressRelease;
|
||||
use Illuminate\Support\Str;
|
||||
use Livewire\Volt\Volt;
|
||||
use Tests\TestCase;
|
||||
|
||||
function createSearchableRelease(string $title, array $attributes = [], ?Category $category = null, ?Company $company = null): PressRelease
|
||||
{
|
||||
$company ??= Company::factory()->businessportal24()->create();
|
||||
$category ??= Category::factory()->create(['portal' => Portal::Both]);
|
||||
|
||||
return PressRelease::factory()
|
||||
->published()
|
||||
->forPortal(Portal::Businessportal24)
|
||||
->for($category)
|
||||
->for($company)
|
||||
->create(array_merge([
|
||||
'title' => $title,
|
||||
'slug' => Str::slug($title).'-'.fake()->unique()->numberBetween(1000, 9999),
|
||||
'language' => 'de',
|
||||
'published_at' => now()->subDay(),
|
||||
], $attributes));
|
||||
}
|
||||
|
||||
test('the search page renders the editorial shell and discovery state', function () {
|
||||
/** @var TestCase $this */
|
||||
$this->get('https://businessportal24.test/de/suche')
|
||||
->assertSuccessful()
|
||||
->assertSee('businessportal', false)
|
||||
->assertSeeText('Pressemitteilungen durchsuchen')
|
||||
->assertSeeText('Durchsuchen Sie das Archiv');
|
||||
});
|
||||
|
||||
test('the search page returns matching press releases for a query', function () {
|
||||
/** @var TestCase $this */
|
||||
createSearchableRelease('Mittelständischer Fertiger eröffnet neues Werk');
|
||||
|
||||
$this->get('https://businessportal24.test/de/suche?q=Werk')
|
||||
->assertSuccessful()
|
||||
->assertSeeText('Mittelständischer Fertiger eröffnet neues Werk')
|
||||
->assertSeeText('Ergebnis');
|
||||
});
|
||||
|
||||
test('the search component filters by query and resets', function () {
|
||||
/** @var TestCase $this */
|
||||
createSearchableRelease('Solarpark geht ans Netz');
|
||||
createSearchableRelease('Neue Geschäftsführung berufen');
|
||||
|
||||
Volt::test('web.search', ['portal' => Portal::Businessportal24->value, 'language' => 'de'])
|
||||
->set('q', 'Solarpark')
|
||||
->assertSee('Solarpark geht ans Netz')
|
||||
->assertDontSee('Neue Geschäftsführung berufen')
|
||||
->call('clearFilters')
|
||||
->assertSet('q', '')
|
||||
->assertSee('Durchsuchen Sie das Archiv');
|
||||
});
|
||||
|
||||
test('the search component filters by category', function () {
|
||||
/** @var TestCase $this */
|
||||
$energie = Category::factory()->create(['portal' => Portal::Both]);
|
||||
$energie->translations()->create(['locale' => 'de', 'name' => 'Energie', 'slug' => 'energie']);
|
||||
|
||||
$finanzen = Category::factory()->create(['portal' => Portal::Both]);
|
||||
$finanzen->translations()->create(['locale' => 'de', 'name' => 'Finanzen', 'slug' => 'finanzen']);
|
||||
|
||||
createSearchableRelease('Windkraft-Ausbau beschleunigt', category: $energie);
|
||||
createSearchableRelease('Quartalszahlen veröffentlicht', category: $finanzen);
|
||||
|
||||
Volt::test('web.search', ['portal' => Portal::Businessportal24->value, 'language' => 'de'])
|
||||
->call('selectCategory', 'energie')
|
||||
->assertSee('Windkraft-Ausbau beschleunigt')
|
||||
->assertDontSee('Quartalszahlen veröffentlicht');
|
||||
});
|
||||
|
||||
test('the search page is available per edition and portal', function () {
|
||||
/** @var TestCase $this */
|
||||
$this->get('https://businessportal24.test/en/suche')->assertSuccessful();
|
||||
$this->get('https://presseecho.test/de/suche')
|
||||
->assertSuccessful()
|
||||
->assertSee('presse', false);
|
||||
});
|
||||
54
tests/Feature/Web/VeroeffentlichenPageTest.php
Normal file
54
tests/Feature/Web/VeroeffentlichenPageTest.php
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
<?php
|
||||
|
||||
use App\Enums\Portal;
|
||||
use App\Models\Category;
|
||||
use App\Models\Company;
|
||||
use App\Models\PressRelease;
|
||||
use Tests\TestCase;
|
||||
|
||||
test('the veroeffentlichen page renders the editorial shell', function () {
|
||||
/** @var TestCase $this */
|
||||
$this->get('https://businessportal24.test/de/veroeffentlichen')
|
||||
->assertSuccessful()
|
||||
->assertSee('businessportal', false)
|
||||
->assertSeeText('Pressemitteilung veröffentlichen.')
|
||||
->assertSeeText('Vier Prinzipien, die diese Plattform tragen')
|
||||
->assertSeeText('drei Schritte')
|
||||
->assertSeeText('Typische Anlässe einer Veröffentlichung')
|
||||
->assertSeeText('Sie zahlen, was Sie einreichen.')
|
||||
->assertSeeText('Kurz beantwortet')
|
||||
->assertSeeText('Bereit, Ihre Mitteilung einzureichen?');
|
||||
});
|
||||
|
||||
test('the veroeffentlichen page surfaces real newsrooms and an example release', function () {
|
||||
/** @var TestCase $this */
|
||||
$category = Category::factory()->create(['portal' => Portal::Both]);
|
||||
$category->translations()->create(['locale' => 'de', 'name' => 'Maschinenbau', 'slug' => 'maschinenbau']);
|
||||
|
||||
$company = Company::factory()->businessportal24()->create(['name' => 'Brinkmann Präzisionstechnik GmbH']);
|
||||
|
||||
PressRelease::factory()
|
||||
->published()
|
||||
->forPortal(Portal::Businessportal24)
|
||||
->for($category)
|
||||
->for($company)
|
||||
->create([
|
||||
'title' => 'Fertiger eröffnet neues Werk im Westmünsterland',
|
||||
'slug' => 'fertiger-eroeffnet-werk',
|
||||
'published_at' => now()->subDay(),
|
||||
]);
|
||||
|
||||
$this->get('https://businessportal24.test/de/veroeffentlichen')
|
||||
->assertSuccessful()
|
||||
->assertSeeText('Brinkmann Präzisionstechnik GmbH')
|
||||
->assertSeeText('Fertiger eröffnet neues Werk im Westmünsterland')
|
||||
->assertSeeText('Maschinenbau');
|
||||
});
|
||||
|
||||
test('the veroeffentlichen page is available per edition and portal', function () {
|
||||
/** @var TestCase $this */
|
||||
$this->get('https://businessportal24.test/en/veroeffentlichen')->assertSuccessful();
|
||||
$this->get('https://presseecho.test/de/veroeffentlichen')
|
||||
->assertSuccessful()
|
||||
->assertSee('presse', false);
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue