presseportale/tests/Feature/ApiDocumentationTest.php
Kevin Adametz f3a95c854d API-Doku: echte Referenz statt Fantasie-Features
- /de/api komplett neu: reale Endpunkte, Felder, Token-Abilities,
  Rate-Limit und Statuscodes der API v1 (angelehnt an die Legacy-Doku
  von businessportal24.com/service/documentation.html); OAuth/SDKs/
  Webhooks/Integrations-Behauptungen und api.example.com entfernt
- docs/api/v1.yml (OpenAPI 3.1) erstellt — die docs.api.v1-Route lief
  bisher auf eine nie vorhandene Datei (500er aus Hub-Footer/FAQ)
- Token-Vergabe korrekt beschrieben: Selfservice im Konto mit
  Buchungs-Gate statt 'auf Anfrage'; X-ApiKey-Migrationshinweis
- ApiDocumentationTest entskippt + Seiten-Test ergaenzt

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-03 15:36:19 +00:00

25 lines
912 B
PHP

<?php
use Tests\TestCase;
test('api v1 documentation is publicly available', function () {
/** @var TestCase $this */
$this->get('/docs/api/v1')
->assertOk()
->assertHeader('content-type', 'application/yaml; charset=UTF-8')
->assertSee('openapi: 3.1.0', false)
->assertSee('/press-releases:', false)
->assertSee('legacy API keys are no longer supported', false);
});
test('the public api page documents the real endpoints', function () {
/** @var TestCase $this */
$this->get('https://pressekonto.test/de/api')
->assertSuccessful()
->assertSeeText('API-Dokumentation')
->assertSee('/press-releases/{id}/submit', false)
->assertSee('press-releases:write', false)
// Keine Fantasie-Features mehr (OAuth/SDKs/Webhooks gab es nie).
->assertDontSee('OAuth 2.0')
->assertDontSee('api.example.com');
});