← Code-Übersicht

LexwareMoneyTest.php

Pfad: tests/Rechnung/LexwareMoneyTest.php

Ext: php

Größe: 698 Bytes

Geändert: 2026-07-16 17:57:44+02

<?php
declare(strict_types=1);

namespace Demo\Tests\Rechnung;

use Demo\Infrastructure\Rechnung\LexwareMoney;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;

final class LexwareMoneyTest extends TestCase
{
    /** @return iterable<string,array{string,string}> */
    public static function amounts(): iterable
    {
        yield 'net' => ['26.0504', '26.05'];
        yield 'tax rounds up' => ['4.9496', '4.95'];
        yield 'whole gross' => ['31', '31.00'];
    }

    #[DataProvider('amounts')]
    public function testFormatsExactApiCents(string $input, string $expected): void
    {
        self::assertSame($expected, LexwareMoney::format($input));
    }
}