Phase 9 Block 1: Gelb-Routing Direkt-Live, Slot-Verbrauch bei Veroeffentlichung, Submit-Gate
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>
This commit is contained in:
parent
8d8d957884
commit
4419d9ff43
21 changed files with 551 additions and 114 deletions
|
|
@ -31,7 +31,7 @@ test('api create always produces a draft and ignores any status input', function
|
|||
->assertJsonPath('data.status', PressReleaseStatus::Draft->value);
|
||||
});
|
||||
|
||||
test('api submit route raises a draft to review and counts quota and writes a log', function () {
|
||||
test('api submit route raises a draft to review without consuming quota and writes a log', function () {
|
||||
/** @var TestCase $this */
|
||||
Queue::fake(); // Klassifikations-Routing separat getestet; hier nur der Submit-Übergang.
|
||||
|
||||
|
|
@ -50,12 +50,54 @@ test('api submit route raises a draft to review and counts quota and writes a lo
|
|||
->assertJsonPath('data.status', PressReleaseStatus::Review->value);
|
||||
|
||||
expect($pressRelease->fresh()->status)->toBe(PressReleaseStatus::Review);
|
||||
expect($user->fresh()->press_release_quota_used_this_month)->toBe(1);
|
||||
// Slot-Verbrauch erst bei Veröffentlichung (Decision-Update §3.2).
|
||||
expect($user->fresh()->press_release_quota_used_this_month)->toBe(0);
|
||||
expect(PressReleaseStatusLog::where('press_release_id', $pressRelease->id)
|
||||
->where('to_status', PressReleaseStatus::Review->value)
|
||||
->exists())->toBeTrue();
|
||||
});
|
||||
|
||||
test('api submit responds 402 when the booking gate is enforced', function () {
|
||||
/** @var TestCase $this */
|
||||
config()->set('billing.enforce_booking', true);
|
||||
|
||||
$user = User::factory()->create();
|
||||
$pressRelease = PressRelease::factory()->create([
|
||||
'user_id' => $user->id,
|
||||
'status' => PressReleaseStatus::Draft->value,
|
||||
'title' => 'Saubere Pressemitteilung',
|
||||
'text' => 'Inhalt',
|
||||
]);
|
||||
|
||||
Sanctum::actingAs($user, ['press-releases:write']);
|
||||
|
||||
$this->postJson("/api/v1/press-releases/{$pressRelease->id}/submit")
|
||||
->assertStatus(402);
|
||||
|
||||
expect($pressRelease->fresh()->status)->toBe(PressReleaseStatus::Draft);
|
||||
});
|
||||
|
||||
test('api submit responds 422 when the monthly quota is exhausted', function () {
|
||||
/** @var TestCase $this */
|
||||
$user = User::factory()->create([
|
||||
'press_release_quota' => 3,
|
||||
'press_release_quota_used_this_month' => 3,
|
||||
]);
|
||||
$pressRelease = PressRelease::factory()->create([
|
||||
'user_id' => $user->id,
|
||||
'status' => PressReleaseStatus::Draft->value,
|
||||
'title' => 'Saubere Pressemitteilung',
|
||||
'text' => 'Inhalt',
|
||||
]);
|
||||
|
||||
Sanctum::actingAs($user, ['press-releases:write']);
|
||||
|
||||
$this->postJson("/api/v1/press-releases/{$pressRelease->id}/submit")
|
||||
->assertStatus(422);
|
||||
|
||||
expect($pressRelease->fresh()->status)->toBe(PressReleaseStatus::Draft);
|
||||
});
|
||||
|
||||
test('api submit auto-rejects a press release containing a banned word', function () {
|
||||
/** @var TestCase $this */
|
||||
config()->set('blacklist.words', ['penis']);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue