newsroom: Seite verschwindet mit der letzten veröffentlichten Meldung (Roadmap 1b.1/1b.5)

Die Sichtbarkeitsregel bestand bereits (Detailseite 404, Verzeichnis und
Sitemap nur mit veröffentlichter Meldung). Neu: archive(),
changeStatusFromAdmin() weg von published und deleteFromAdmin() einer
veröffentlichten Meldung leeren den Seiten-Cache — vorher blieb die
Newsroom-Seite bis zu eine Stunde stehen, während die Depublikation längst
sofort griff.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Kevin Adametz 2026-09-15 10:34:14 +00:00
parent 0f52e9fddc
commit a3e0042055
2 changed files with 55 additions and 0 deletions

View file

@ -1,9 +1,11 @@
<?php
use App\Enums\Portal;
use App\Enums\PressReleaseStatus;
use App\Models\Category;
use App\Models\Company;
use App\Models\PressRelease;
use App\Services\PressRelease\PressReleaseService;
use Illuminate\Support\Str;
use Tests\TestCase;
@ -118,6 +120,49 @@ test('the newsroom detail page returns 404 when the company has no published rel
->assertNotFound();
});
test('the newsroom page disappears with its last published release, cache included', function () {
/** @var TestCase $this */
// Roadmap 1b.1/1b.5: öffentlich nur mit veröffentlichter Meldung — und
// der Rückbau greift sofort, nicht erst nach Ablauf des Seiten-Caches.
$company = makeNewsroom('Einmalig AG');
$release = publishForCompany($company, 'Die einzige Meldung');
$url = 'https://businessportal24.test/de/newsroom/'.$company->slug;
$this->get($url)->assertOk();
$this->get('https://businessportal24.test/de/newsrooms')->assertSeeText('Einmalig AG');
app(PressReleaseService::class)->archive($release);
$this->get($url)->assertNotFound();
$this->get('https://businessportal24.test/de/newsrooms')->assertDontSeeText('Einmalig AG');
});
test('an admin status change away from published takes the newsroom page down', function () {
/** @var TestCase $this */
$company = makeNewsroom('Rückzug GmbH');
$release = publishForCompany($company, 'Zurückgezogen');
$url = 'https://businessportal24.test/de/newsroom/'.$company->slug;
$this->get($url)->assertOk();
app(PressReleaseService::class)->changeStatusFromAdmin($release, PressReleaseStatus::Draft);
$this->get($url)->assertNotFound();
});
test('deleting the last published release from admin takes the newsroom page down', function () {
/** @var TestCase $this */
$company = makeNewsroom('Gelöscht KG');
$release = publishForCompany($company, 'Wird entfernt');
$url = 'https://businessportal24.test/de/newsroom/'.$company->slug;
$this->get($url)->assertOk();
app(PressReleaseService::class)->deleteFromAdmin($release);
$this->get($url)->assertNotFound();
});
test('the newsrooms pages are available per edition and portal', function () {
/** @var TestCase $this */
$this->get('https://businessportal24.test/en/newsrooms')->assertSuccessful();