Files

50 lines
1.6 KiB
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
namespace App\Process\Tester\Scenarios;
use App\Enums\IntakeKind;
use App\Process\Tester\SandboxContext;
use Illuminate\Mail\Events\MessageSending;
use Illuminate\Support\Facades\Event;
use Symfony\Component\Mailer\Exception\TransportException;
/**
* S12: the mail server fails when the request comes in – the case must be kept and show a defined state (the real
* error type of the transport, no crash). The failure is simulated where every mail passes (MessageSending), without a
* transport of its own.
*/
final class CommunicationFailure extends Scenario
{
public static function key(): string
{
return 'mail_failure';
}
public static function label(): string
{
return 'Mailversand fällt aus';
}
public static function description(): string
{
return 'Beim Eingang der Anfrage ist der Mailserver nicht erreichbar. Der Vorgang bleibt erhalten und zeigt, was von Hand zu tun ist.';
}
public static function intakes(): array
{
return [IntakeKind::Inquiry];
}
public function events(array $inputs): array
{
return [
new ScenarioEvent('Mailserver fällt aus', function (SandboxContext $context): void {
Event::listen(MessageSending::class, function (): void {
throw new TransportException('Verbindung zum Mailserver fehlgeschlagen (simuliert).');
});
}),
new ScenarioEvent('Gast fragt mit allen Angaben an', fn (SandboxContext $context) => $context->request(['street' => 'Teststraße 1', 'postal_code' => '18225', 'city' => 'Kühlungsborn', 'country' => 'DE'])),
];
}
}