Ergänze Aufbewahrung, Dokumentation und den Vertrag der Widget-Registry für das Widget Anfrage
CI Feature / test (push) Successful in 4m41s
CI Feature / test (push) Successful in 4m41s
Der Registry-Test erlaubt bewusst Widgets, die nur aus einem Verweis bestehen (Anfrage: nur die Kennung eines Einstiegs) und kennt die neue Widget-Art. ADR-60, Beschreibung der Kommunikationsverwaltung, Rückfall und Migration in der Release-Vorbereitung. Der Browser meldet laufende Zustandsabfragen über aria-busy. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
c6a8167601
commit
22f8afdcd6
9 files changed
+257
-6
No files matched your search
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use App\Domain\Communication\CommunicationSettings;
|
||||
use App\Domain\Communication\ExampleConfiguration;
|
||||
use App\Domain\Communication\FormToken;
|
||||
use App\Domain\Communication\Inquiry;
|
||||
use App\Domain\Communication\InquiryEntry;
|
||||
use App\Domain\Communication\InquiryService;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\TestCase;
|
||||
|
||||
class CommunicationPurgeTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
private function inquiry(string $email): Inquiry
|
||||
{
|
||||
config(['communication.min_fill_seconds' => 0]);
|
||||
$entry = InquiryEntry::query()->where('key', 'allgemeiner_kontakt')->firstOrFail();
|
||||
$result = app(InquiryService::class)->submit($entry, [
|
||||
'token' => FormToken::issue($entry->id, $entry->template->published_version_id),
|
||||
'values' => ['name' => 'Mira', 'email' => $email, 'nachricht' => 'Hallo'],
|
||||
]);
|
||||
|
||||
return Inquiry::query()->where('reference', $result['reference'])->firstOrFail();
|
||||
}
|
||||
|
||||
public function test_nothing_is_deleted_without_a_retention_period(): void
|
||||
{
|
||||
app(ExampleConfiguration::class)->install();
|
||||
$old = $this->inquiry('alt@example.org');
|
||||
$old->forceFill(['created_at' => now()->subYears(5)])->save();
|
||||
|
||||
$this->artisan('communication:purge')->expectsOutputToContain('nichts gelöscht')->assertSuccessful();
|
||||
|
||||
$this->assertSame(1, Inquiry::query()->count());
|
||||
}
|
||||
|
||||
public function test_only_inquiries_older_than_the_retention_period_are_deleted(): void
|
||||
{
|
||||
app(ExampleConfiguration::class)->install();
|
||||
CommunicationSettings::current()->update(['retention_months' => 12]);
|
||||
$old = $this->inquiry('alt@example.org');
|
||||
$old->forceFill(['created_at' => now()->subMonths(13)])->save();
|
||||
$this->inquiry('neu@example.org');
|
||||
|
||||
$this->artisan('communication:purge', ['--pretend' => true])->expectsOutputToContain('1 Anfragen wären älter')->assertSuccessful();
|
||||
$this->assertSame(2, Inquiry::query()->count());
|
||||
|
||||
$this->artisan('communication:purge')->expectsOutputToContain('1 Anfragen gelöscht')->assertSuccessful();
|
||||
|
||||
$this->assertSame(['neu@example.org'], Inquiry::query()->pluck('contact_email')->all());
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user