presseportale/tests/Feature/Web/LlmsTxtTest.php
Kevin Adametz b60a28dc9c web: Entitaeten im JSON-LD verknuepft, News-Sitemap und llms.txt (Roadmap 2.1, 2.2, 2.7)
- App\Support\StructuredData: Portal-Organization als Publisher mit @id
  und Logo (ImageObject), Newsroom-@id; NewsArticle.author auf der
  Meldung und Organization auf der Newsroom-Seite beschreiben jetzt
  dieselbe Entitaet. Startseiten nutzen denselben Publisher.
- /sitemap-news.xml je Spoke (NewsSitemapController): im Archiv
  sichtbare Meldungen der letzten 48 h, max. 1.000, news:publication
  mit Portalname und Sprache; 15 min gecacht, mit den anderen Sitemaps
  geleert; in robots.txt der Spokes. Hub liefert leere Liste.
- /llms.txt je Host (LlmsTxtController): sachliche Beschreibung,
  URL-Aufbau, aktive Kategorien, Seiten fuer Unternehmen, Rechtliches;
  Hub verweist auf beide Portale. Keine Aussagen ueber KI-Nennungen.
- Protokoll Teil 5 (Block 2) inkl. Betreiber-Schritten fuer das
  Publisher Center und Befund zu 2.5/E5; Roadmap 2.1/2.7 abgehakt.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-17 10:15:28 +00:00

45 lines
1.9 KiB
PHP

<?php
use App\Enums\Portal;
use App\Models\Category;
use Tests\TestCase;
/**
* `/llms.txt` je Host (Roadmap 2.7): sachliche Beschreibung, URL-Aufbau,
* Kategorien — ohne Werbeaussagen.
*/
test('a spoke serves llms.txt with its structure, categories and legal pages', function () {
/** @var TestCase $this */
$category = Category::factory()->create(['portal' => Portal::Presseecho, 'is_active' => true]);
$category->translations()->create(['locale' => 'de', 'name' => 'Energie', 'slug' => 'energie']);
$inactive = Category::factory()->create(['portal' => Portal::Presseecho, 'is_active' => false]);
$inactive->translations()->create(['locale' => 'de', 'name' => 'Veraltet', 'slug' => 'veraltet']);
$response = $this->get('https://presseecho.test/llms.txt')
->assertSuccessful()
->assertHeader('Content-Type', 'text/plain; charset=UTF-8');
$text = (string) $response->getContent();
expect($text)
->toStartWith("# presseecho\n\n> ")
->toContain('https://presseecho.test/de/press-release/{slug}')
->toContain('https://presseecho.test/sitemap-news.xml')
->toContain('- [Energie](https://presseecho.test/de/category/energie)')
->toContain('- [Impressum](https://presseecho.test/de/impressum)')
->toContain('NewsArticle');
$this->assertStringNotContainsString('veraltet', $text);
});
test('the hub serves llms.txt that points to both portals', function () {
/** @var TestCase $this */
$text = (string) $this->get('https://pressekonto.test/llms.txt')->assertSuccessful()->getContent();
expect($text)
->toStartWith("# pressekonto\n\n> ")
->toContain('https://presseecho.test/llms.txt')
->toContain('https://businessportal24.test/llms.txt')
->toContain('https://pressekonto.test/docs/api/v1');
$this->assertStringNotContainsString('press-release/{slug}', $text);
});