36 lines
1.5 KiB
PHP
36 lines
1.5 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Tests\Service;
|
|
|
|
use App\BusProNet\Model\Notification;
|
|
use App\Service\VoucherSaleRejectionMapper;
|
|
use PHPUnit\Framework\Attributes\DataProvider;
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
class VoucherSaleRejectionMapperTest extends TestCase
|
|
{
|
|
/**
|
|
* @return iterable<string, array{int, string, int}>
|
|
*/
|
|
public static function probedRejections(): iterable
|
|
{
|
|
yield 'unknown template' => [602, 'Gutscheine mit ID 999 nicht gefunden', 1];
|
|
yield 'recipient missing' => [605, 'Empfängername fehlt', 1];
|
|
yield 'below minimum' => [607, 'Gutscheinbetrag darf nicht kleiner als 10,00 Euro sein', 1];
|
|
yield 'above maximum' => [608, 'Gutscheinbetrag darf nicht größer als 5.000,00 Euro sein', 1];
|
|
yield 'capacity' => [616, 'Kapazität nicht ausreichend', 1];
|
|
yield 'email missing' => [650, 'Fehlende Adress Daten. Bitte folgende Eingabefelder prüfen: Mail-Adresse', 2];
|
|
yield 'street missing' => [650, 'Fehlende Adress Daten. Bitte folgende Eingabefelder prüfen: Strasse', 2];
|
|
yield 'payment method missing' => [618, 'Zahlungsart fehlt', 3];
|
|
yield 'agency' => [619, 'Agentur-ID fehlt', 3];
|
|
}
|
|
|
|
#[DataProvider('probedRejections')]
|
|
public function testTheRejectionGoesBackToTheStepThatOwnsIt(int $code, string $message, int $step): void
|
|
{
|
|
self::assertSame($step, (new VoucherSaleRejectionMapper())->stepFor(new Notification($code, $message)));
|
|
}
|
|
}
|