Abo Einmalprodukte: Phasen 5-7, konfigurierbare Sperrfristen, Lokalisierung & Dashboard
Rechnung/Lieferschein: - PDF-Gruppierung Abo- vs. Einmal-Artikel (is_abo_addon), rueckwaertskompatibel - Vorschau-Command sales:preview-invoice (umgeht Test-System-Gate, ohne Rechnungsnummer) Reminder-Mail (vorbereitet, Cron inaktiv): - MailAboExecutionReminder + Template, abo:send-execution-reminder, Spalte onetime_reminder_sent_for - Berater -> Sales Center, Kunde -> Portal; Vorschau abo:preview-reminder - Datum-Fix: formatDateDB() statt formatDate() (ICU-Format) Sperrfristen konfigurierbar (Admin-Settings): - abo-lock-days-change (Liefertag + Abo-Produkte), abo-lock-days-pause-cancel - Meldungen mit :lock-Platzhalter; Pausieren/Kuendigen vom Change-Lock entkoppelt - Abo-Produkt-Aenderungen im Lock-Fenster server- + clientseitig eingefroren - Selbstbedienung: Add-only/Lock nach $view (kein Admin-Bypass), Stale-Cache-Fix beim Mengen-Update Dashboard: - Einmalprodukte-Card + Team-Abo-KPI-Card, News-Card responsiv (col-xl-6) Lokalisierung: - Sprachdateien en/es/fr vollstaendig mit de synchronisiert (inkl. marketingplan/portal) - LocalizationSyncTest sichert Key-Gleichheit ab Tests: AboOneTimeInvoiceGrouping, AboExecutionReminder, AboLockDaysSetting, AboOnetimeDashboardAndMail, PreviewInvoiceCommand, TeamAboOverview + erweiterte View-Tests Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
9f996a7f1b
commit
65b867f8ee
96 changed files with 4154 additions and 1189 deletions
64
tests/Feature/AboOnetimeDashboardAndMailTest.php
Normal file
64
tests/Feature/AboOnetimeDashboardAndMailTest.php
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
<?php
|
||||
|
||||
use App\Mail\MailAboExecutionReminder;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Support\Facades\URL;
|
||||
|
||||
uses(Tests\TestCase::class, RefreshDatabase::class);
|
||||
|
||||
beforeEach(fn () => makeShopEnv());
|
||||
|
||||
describe('Dashboard-Card Einmalprodukte', function () {
|
||||
it('zeigt die Card mit Link zum eigenen Abo', function () {
|
||||
// Domain-aware Route wird im Test-Kontext nicht geladen -> route() mocken
|
||||
URL::shouldReceive('route')->andReturnUsing(
|
||||
fn ($name, $params = [], $absolute = true) => '/user/abos/detail/'.($params['view'] ?? '').'/'.($params['id'] ?? '')
|
||||
);
|
||||
|
||||
$abo = makeMeAbo();
|
||||
|
||||
$html = view('dashboard._abo_onetime', ['oneTimeAbo' => $abo])->render();
|
||||
|
||||
expect($html)->toContain(__('abo.onetime_card_hl'))
|
||||
->and($html)->toContain(__('abo.add_onetime_product'))
|
||||
->and($html)->toContain('/user/abos/detail/me/'.$abo->id);
|
||||
});
|
||||
|
||||
it('rendert nichts, wenn kein Abo übergeben wird', function () {
|
||||
$html = view('dashboard._abo_onetime', ['oneTimeAbo' => null])->render();
|
||||
|
||||
expect(trim($html))->toBe('');
|
||||
});
|
||||
});
|
||||
|
||||
describe('Reminder-Mail-Vorschau Command', function () {
|
||||
it('rendert die Reminder-Mail als HTML ohne Versand', function () {
|
||||
Storage::fake('public');
|
||||
Mail::fake();
|
||||
$abo = makeMeAbo();
|
||||
|
||||
$this->artisan('abo:preview-reminder', ['abo' => $abo->id])->assertExitCode(0);
|
||||
|
||||
Storage::disk('public')->assertExists('preview/abo-reminder-'.$abo->id.'.html');
|
||||
$html = Storage::disk('public')->get('preview/abo-reminder-'.$abo->id.'.html');
|
||||
expect($html)->toContain('/user/abos/detail/me/'.$abo->id);
|
||||
Mail::assertNothingSent();
|
||||
});
|
||||
|
||||
it('versendet zusätzlich bei --send (Mailpit-Test)', function () {
|
||||
Storage::fake('public');
|
||||
Mail::fake();
|
||||
$abo = makeMeAbo();
|
||||
|
||||
$this->artisan('abo:preview-reminder', ['abo' => $abo->id, '--send' => 'test@example.com'])
|
||||
->assertExitCode(0);
|
||||
|
||||
Mail::assertSent(MailAboExecutionReminder::class, 1);
|
||||
});
|
||||
|
||||
it('lehnt ein unbekanntes Abo ab', function () {
|
||||
$this->artisan('abo:preview-reminder', ['abo' => 999999])->assertExitCode(1);
|
||||
});
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue