More improvements

This commit is contained in:
2026-08-05 10:55:06 +02:00
parent e55cdd1988
commit a0d26648ee
20 changed files with 279 additions and 216 deletions
+4 -51
View File
@@ -3,12 +3,15 @@
namespace Tests\Unit;
use App\EventPaymentModules\DTO\RegistrationSummaryRequest;
use App\EventPaymentModules\Modules\AccountTransferPaymentModule;
use App\EventPaymentModules\Modules\UndefinedPaymentModule;
use App\Models\EventParticipant;
use App\ValueObjects\Amount;
use PHPUnit\Framework\TestCase;
/**
* Reine Modul-Logik ohne Framework-Kontext. Das Überweisungs-Modul rendert inzwischen Blade und wird
* daher auf Feature-Ebene getestet (siehe EventParticipantPaymentSummaryTest).
*/
class RegistrationSummaryTest extends TestCase
{
private function participant(float $amount, float $amountPaid, string $purpose = 'Zweck'): EventParticipant
@@ -24,56 +27,6 @@ class RegistrationSummaryTest extends TestCase
return $participant;
}
public function test_account_transfer_summary_builds_lines_from_config(): void
{
$module = new AccountTransferPaymentModule();
$request = new RegistrationSummaryRequest(
$this->participant(50.0, 0.0, 'Camp - Beitrag'),
['account_owner' => 'Kasse', 'iban' => 'DE123', 'bic' => 'XY'],
);
$summary = $module->registrationSummary($request);
$this->assertTrue($summary->hasPaymentInformation);
$this->assertTrue($summary->showGiroCode);
$this->assertNull($summary->html);
$byLabel = [];
foreach ($summary->lines as $line) {
$byLabel[$line['label']] = $line['value'];
}
$this->assertSame('Kasse', $byLabel['Kontoinhaber']);
$this->assertSame('DE123', $byLabel['IBAN']);
$this->assertSame('Camp - Beitrag', $byLabel['Verwendungszweck']);
$this->assertArrayHasKey('Betrag', $byLabel);
}
public function test_account_transfer_without_open_amount_has_no_payment_information(): void
{
$module = new AccountTransferPaymentModule();
$summary = $module->registrationSummary(new RegistrationSummaryRequest(
$this->participant(50.0, 50.0),
['account_owner' => 'Kasse', 'iban' => 'DE123'],
));
$this->assertFalse($summary->hasPaymentInformation);
$this->assertFalse($summary->showGiroCode);
}
public function test_cash_summary_returns_configured_html(): void
{
$module = new UndefinedPaymentModule();
$summary = $module->registrationSummary(new RegistrationSummaryRequest(
$this->participant(50.0, 0.0),
['payment_information' => '<p>Bitte bar vor Ort zahlen.</p>'],
));
$this->assertTrue($summary->hasPaymentInformation);
$this->assertFalse($summary->showGiroCode);
$this->assertSame('<p>Bitte bar vor Ort zahlen.</p>', $summary->html);
$this->assertSame([], $summary->lines);
}
public function test_cash_summary_empty_when_no_text_configured(): void
{
$module = new UndefinedPaymentModule();