9A — Gelb geht direkt live (Entscheidung 12.06.2026): - routeByClassification(): Gelb durchlaeuft denselben Auto-Publish-Pfad wie Gruen (autoPublishApproved); nur Rot wird abgelehnt - Scheduler publiziert faellige gelbe + gruene PMs; unklassifizierte bleiben als Fallback in der manuellen Queue 9B — Slot-Verbrauch bei Veroeffentlichung (Decision-Update 3.2): - Increment aus submitForReview() entfernt; publish() und changeStatusFromAdmin() zaehlen idempotent beim ersten published-Uebergang (Pruefung ueber Status-Logs); Rot kostet nichts - Submit-Guard: Einreichen erfordert freien Slot (QuotaExceededException, API 422) 9C — Submit-Gate vorbereitet (Decision-Update 5.1): - User::hasActiveBooking()-Stub hinter config/billing.php (enforce_booking, Default aus); Tarif-Modul ersetzt nur den Rumpf - Einreichungs-Modal zeigt ohne Buchung einen Buchungs-Hinweis; Server-Guard (BookingRequiredException), API antwortet 402 - Fix: Customer-Create legte PMs bei "Zur Pruefung senden" direkt mit Status review an (vorbei an Blacklist/Quota/KI/Status-Log) — laeuft jetzt immer ueber submitForReview() Suite: 451 passed, 4 skipped (9 neue Tests). Pint clean. Plan: docs/PHASE-9-FLOW-UND-TARIFE-PLAN.md (Block 2 nach Review-Stopp). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
56 lines
2.2 KiB
PHP
56 lines
2.2 KiB
PHP
<?php
|
|
|
|
use App\Enums\PressReleaseStatus;
|
|
use Database\Seeders\RolesAndPermissionsSeeder;
|
|
use Illuminate\Support\Facades\Queue;
|
|
use Livewire\Volt\Volt as LivewireVolt;
|
|
use Tests\TestCase;
|
|
|
|
beforeEach(function (): void {
|
|
/** @var TestCase $this */
|
|
$this->seed(RolesAndPermissionsSeeder::class);
|
|
|
|
// Klassifikations-Job nicht inline ausführen, damit der Submit hier nur den
|
|
// Übergang nach „review" prüft (KI-Routing siehe ClassificationJobTest).
|
|
Queue::fake();
|
|
});
|
|
|
|
test('customer show renders the publish confirmation modal with legal note and quota', function () {
|
|
/** @var TestCase $this */
|
|
['customer' => $customer, 'pr' => $pr] = makeCustomerForShowPhase8a();
|
|
$customer->update(['press_release_quota' => 3, 'press_release_quota_used_this_month' => 1]);
|
|
$this->actingAs($customer);
|
|
|
|
LivewireVolt::test('customer.press-releases.show', ['id' => $pr->id])
|
|
->assertSee('Pressemitteilung zur Prüfung einreichen')
|
|
->assertSee('Mit dem Einreichen versichern Sie:')
|
|
->assertSee('PM-Kontingent diesen Monat')
|
|
->assertSee('2 / 3');
|
|
});
|
|
|
|
test('submitting from the show modal moves the draft into review without consuming quota', function () {
|
|
/** @var TestCase $this */
|
|
['customer' => $customer, 'pr' => $pr] = makeCustomerForShowPhase8a();
|
|
$customer->update(['press_release_quota' => 3, 'press_release_quota_used_this_month' => 0]);
|
|
$this->actingAs($customer);
|
|
|
|
LivewireVolt::test('customer.press-releases.show', ['id' => $pr->id])
|
|
->call('submitForReview')
|
|
->assertHasNoErrors();
|
|
|
|
expect($pr->fresh()->status)->toBe(PressReleaseStatus::Review);
|
|
// Slot-Verbrauch erst bei Veröffentlichung (Decision-Update §3.2).
|
|
expect($customer->fresh()->press_release_quota_used_this_month)->toBe(0);
|
|
});
|
|
|
|
test('the modal shows a booking notice instead of the submit flow when the gate is enforced', function () {
|
|
/** @var TestCase $this */
|
|
config()->set('billing.enforce_booking', true);
|
|
|
|
['customer' => $customer, 'pr' => $pr] = makeCustomerForShowPhase8a();
|
|
$this->actingAs($customer);
|
|
|
|
LivewireVolt::test('customer.press-releases.show', ['id' => $pr->id])
|
|
->assertSee('Buchung erforderlich')
|
|
->assertDontSee('Mit dem Einreichen versichern Sie:');
|
|
});
|