Log-Analyse 26.08. (P1-1, P2-1, P2-7, P2-8): - MyLog schrieb in den nicht definierten Kanal userabo (109 EMERGENCY- Eintraege, laravel.log rotierte nicht mehr); jetzt abo_order. - MyLog verschickt die Benachrichtigung ueber die Queue, ein Mailfehler bricht den Zahllauf nicht mehr ab. MailLog sammelt Nutzer, User-Agent und Zeit beim Erzeugen ein, weil der Worker keinen Request hat. - Abgelehnte OAuth-Anfragen (falscher grant_type) werden als Warnung geloggt statt als Fehler gemailt. - payments:check-accounts loggt je Berater nur noch auf debug und schreibt am Ende eine Zusammenfassung (geprueft, versendet, uebersprungen). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
33 lines
880 B
PHP
33 lines
880 B
PHP
<?php
|
|
|
|
use App\Mail\MailLog;
|
|
use App\Services\MyLog;
|
|
use Illuminate\Support\Facades\Mail;
|
|
use Tests\TestCase;
|
|
|
|
uses(TestCase::class);
|
|
|
|
it('queues the notification instead of sending it synchronously', function () {
|
|
Mail::fake();
|
|
|
|
MyLog::writeLog('abo_order', 'error', 'Testfehler', ['errorcode' => '5']);
|
|
|
|
Mail::assertQueued(MailLog::class);
|
|
Mail::assertNothingSent();
|
|
});
|
|
|
|
it('does not send a notification when the caller opts out', function () {
|
|
Mail::fake();
|
|
|
|
MyLog::writeLog('abo_order', 'error', 'Testfehler', ['errorcode' => '5'], false);
|
|
|
|
Mail::assertNothingQueued();
|
|
});
|
|
|
|
it('does not let a failing notification abort the caller', function () {
|
|
Mail::shouldReceive('to')->once()->andThrow(new RuntimeException('SMTP down'));
|
|
|
|
MyLog::writeLog('abo_order', 'error', 'Testfehler', ['errorcode' => '5']);
|
|
|
|
expect(true)->toBeTrue();
|
|
});
|