presseportale/tests/Feature/Web/RssPageTest.php
Kevin Adametz ff75159b8f web: RSS-Feed je Newsroom, RSS-Übersichtsseite, „RSS" in der Topleiste (Roadmap 3.1, Nachtrag)
- /{edition}/newsroom/{slug}/feed: Sichtbarkeit wie die Newsroom-Seite
  (aktiv, nicht entfernt, mindestens eine Meldung), Prüfung vor dem Cache,
  301 bei zusammengeführter Firma; Autodiscovery und Link „RSS-Feed" auf
  der Newsroom-Seite; Hub leitet auf das Portal der Firma.
- /{edition}/rss (RssPageController, static.rss DE/EN): Was RSS ist, wie
  ein Reader funktioniert, Hauptfeed, alle Branchen-Feeds mit Adresse,
  Muster des Newsroom-Feeds, Hinweise. Portalseite mit Portal-Kontext,
  Hub → presseecho, in Sitemap und llms.txt.
- Topleiste, Burger-Menü und Footer verlinken RSS neben FAQ/Hilfe/API.
- FeedController in portal/category/newsroom aufgeteilt; Panel
  „Auslieferung" nennt zusätzlich den Newsroom-Feed.
- Tests: FeedTest (+3), RssPageTest (4), StaticPagesTest, VisibilityStatsTest.
- dev/2026-09-01: Nachtrag in Protokoll Teil 11 und Roadmap 3.1.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-21 08:27:14 +00:00

73 lines
3.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\Enums\Portal;
use App\Models\Category;
use Tests\TestCase;
/**
* RSS-Übersichtsseite (Roadmap 3.1): erklärt Feeds und listet Hauptfeed,
* Branchen-Feeds und das Newsroom-Muster. Verlinkt aus der Topleiste.
*/
function rssCategory(string $slug, string $name, Portal $portal = Portal::Presseecho): Category
{
$category = Category::factory()->create(['portal' => $portal, 'is_active' => true]);
$category->translations()->create(['locale' => 'de', 'name' => $name, 'slug' => $slug]);
$category->translations()->create(['locale' => 'en', 'name' => $name.' EN', 'slug' => $slug.'-en']);
return $category;
}
test('the rss page explains feeds and lists the main feed, every industry feed and the newsroom pattern', function () {
/** @var TestCase $this */
rssCategory('handel', 'Handel');
rssCategory('energie', 'Energie');
$inactive = rssCategory('veraltet', 'Veraltet');
$inactive->update(['is_active' => false]);
rssCategory('fremd', 'Fremdportal', Portal::Businessportal24);
$this->get('https://presseecho.test/de/rss')
->assertSuccessful()
->assertSeeText('RSS-Feeds')
->assertSeeText('Was ist RSS?')
->assertSeeText('So funktioniert es')
->assertSeeText('Feeds auf presseecho')
->assertSee('href="https://presseecho.test/de/feed"', false)
->assertSeeText('https://presseecho.test/de/category/handel/feed')
->assertSeeText('https://presseecho.test/de/category/energie/feed')
->assertSeeText('/newsroom/unternehmen/feed')
->assertSee('href="https://businessportal24.test/de/rss"', false)
->assertSee('<link rel="alternate" type="application/rss+xml" title="RSS-Feed: alle Pressemitteilungen – presseecho" href="https://presseecho.test/de/feed">', false)
->assertDontSeeText('veraltet/feed')
->assertDontSeeText('fremd/feed');
});
test('the rss page renders in english on the en edition', function () {
/** @var TestCase $this */
rssCategory('handel', 'Handel', Portal::Both);
$this->get('https://businessportal24.test/en/rss')
->assertSuccessful()
->assertSeeText('What is RSS?')
->assertSeeText('https://businessportal24.test/en/category/handel-en/feed')
->assertSee('href="https://businessportal24.test/en/feed"', false);
});
test('the top bar, the mobile menu and the footer link to the rss page', function () {
/** @var TestCase $this */
$html = (string) $this->get('https://presseecho.test/de')->assertSuccessful()->getContent();
// Topleiste (Desktop), Burger-Menü und Footer — route() trägt in der Suite den konfigurierten Root-Host, deshalb nur der Pfad.
expect(substr_count($html, '/de/rss"'))->toBeGreaterThanOrEqual(3);
});
test('the hub sends the rss page to the leading portal and the sitemap lists it on the portals only', function () {
/** @var TestCase $this */
$this->get('https://pressekonto.test/de/rss')
->assertRedirect('https://presseecho.test/de/rss')
->assertStatus(301);
$this->get('https://presseecho.test/sitemap.xml')
->assertSee('<loc>https://presseecho.test/de/rss</loc>', false);
$this->get('https://pressekonto.test/sitemap.xml')
->assertDontSee('/de/rss</loc>', false);
});