PM-Detailseite: Depublikations-Sektion ans Seitenende verschoben

Der seltene Ausnahme-Service stand zwischen Add-ons und Inhalt; jetzt
steht er als letzte Sektion unter dem Inhalt (QA-Befund 07.07.). Dazu
zwei UI-Tests: Sektion + Unternehmer-Bestätigungs-Protokoll auf der
Detailseite, Ausblenden ohne Preis bzw. bei laufendem Vorgang.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Kevin Adametz 2026-07-07 14:35:42 +00:00
parent 9600a4f887
commit d7f17bbc76
2 changed files with 103 additions and 55 deletions

View file

@ -15,6 +15,7 @@ use Database\Seeders\RolesAndPermissionsSeeder;
use Illuminate\Http\RedirectResponse;
use Laravel\Cashier\Checkout;
use Laravel\Cashier\Events\WebhookReceived;
use Livewire\Volt\Volt as LivewireVolt;
use Tests\TestCase;
beforeEach(function (): void {
@ -114,6 +115,51 @@ test('the depublication checkout creates a pending purchase and hands it to stri
expect(SinglePurchase::count())->toBe(1);
});
test('the detail page offers depublication and logs the entrepreneur confirmation', function () {
/** @var TestCase $this */
$user = depublicationCustomer();
$release = publishedReleaseFor($user);
BookingConfirmation::query()->delete(); // nur die Bestätigung aus dem Test-Setup entfernen
$this->actingAs($user);
LivewireVolt::test('customer.press-releases.show', ['id' => $release->id])
->assertSee('Depublikation (Service)')
->assertSee('Kostenpflichtig depublizieren')
->set('depublicationConfirmed', true);
$confirmation = BookingConfirmation::sole();
expect($confirmation->booking_type)->toBe('depublication');
expect($confirmation->booking_ref)->toBe((string) $release->id);
expect($confirmation->user_id)->toBe($user->id);
});
test('the detail page hides the depublication offer without a price and after a purchase', function () {
/** @var TestCase $this */
$user = depublicationCustomer();
$release = publishedReleaseFor($user);
$this->actingAs($user);
// Ohne konfigurierten Preis erscheint die Sektion gar nicht (T12).
config()->set('billing.depublication_price_cents', null);
LivewireVolt::test('customer.press-releases.show', ['id' => $release->id])
->assertDontSee('Depublikation (Service)');
// Mit laufendem Vorgang: Hinweis statt erneutem Kauf-Button.
config()->set('billing.depublication_price_cents', 19900);
SinglePurchase::query()->create([
'user_id' => $user->id,
'type' => SinglePurchaseType::Depublication->value,
'status' => SinglePurchaseStatus::Pending->value,
'price_cents' => 19900,
'currency' => 'EUR',
'press_release_id' => $release->id,
]);
LivewireVolt::test('customer.press-releases.show', ['id' => $release->id])
->assertSee('Für diese Pressemitteilung liegt bereits ein Depublikations-Vorgang vor.')
->assertDontSee('Kostenpflichtig depublizieren');
});
test('the paid webhook depublishes the release and the public page shows a tombstone', function () {
/** @var TestCase $this */
$user = depublicationCustomer();