Vierte Bestaetigung im Einreichungs-Modal (sofortige Ausfuehrung, Erloeschen des Widerrufsrechts mit Vertragserfuellung); Zeitpunkt wird beim Submit als withdrawal_waiver_consented_at an der PM protokolliert. Index-Schnell-Submit (wire:confirm) durch das gemeinsame Modal ersetzt - der Pfad umging bisher alle rechtlichen Bestaetigungen. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
57 lines
2.1 KiB
PHP
57 lines
2.1 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);
|
|
|
|
Queue::fake();
|
|
});
|
|
|
|
test('the submit modal requires the withdrawal waiver confirmation', function () {
|
|
/** @var TestCase $this */
|
|
['customer' => $customer, 'pr' => $pr] = makeCustomerForShowPhase8a();
|
|
$this->actingAs($customer);
|
|
|
|
LivewireVolt::test('customer.press-releases.show', ['id' => $pr->id])
|
|
// Erlöschensklausel (§ 356 Abs. 4/5 BGB) als eigene Bestätigung …
|
|
->assertSee('Ich verlange die sofortige Ausführung')
|
|
->assertSee('Widerrufsrecht mit vollständiger Vertragserfüllung erlischt')
|
|
// … die den Bestätigen-Button mit sperrt.
|
|
->assertSeeHtml('agb && images && contact && waiver');
|
|
});
|
|
|
|
test('submitting records the waiver consent timestamp on the press release', function () {
|
|
/** @var TestCase $this */
|
|
['customer' => $customer, 'pr' => $pr] = makeCustomerForShowPhase8a();
|
|
$this->actingAs($customer);
|
|
|
|
expect($pr->withdrawal_waiver_consented_at)->toBeNull();
|
|
|
|
LivewireVolt::test('customer.press-releases.show', ['id' => $pr->id])
|
|
->call('submitForReview')
|
|
->assertHasNoErrors();
|
|
|
|
$pr->refresh();
|
|
|
|
expect($pr->status)->toBe(PressReleaseStatus::Review);
|
|
expect($pr->withdrawal_waiver_consented_at)->not->toBeNull();
|
|
});
|
|
|
|
test('the index draft action opens the shared submit modal instead of a quick submit', function () {
|
|
/** @var TestCase $this */
|
|
['customer' => $customer] = makeCustomerForShowPhase8a();
|
|
$this->actingAs($customer);
|
|
|
|
LivewireVolt::test('customer.press-releases.index')
|
|
->assertSee('Zur Prüfung')
|
|
// Gemeinsames Modal inkl. Erlöschensklausel statt wire:confirm,
|
|
// das die rechtlichen Bestätigungen umgehen würde.
|
|
->assertSee('Ich verlange die sofortige Ausführung')
|
|
->assertDontSeeHtml('wire:confirm');
|
|
});
|