cents)->toBe($cents); })->with([ 'whole euros' => ['85', 8500], 'comma decimals' => ['85,50', 8550], 'one decimal' => ['85.5', 8550], 'thousands with a space' => ['1 200,00', 120000], 'with the euro sign' => ['0,59 €', 59], 'zero' => ['0', 0], ]); it('treats an empty value as no amount', function () { expect(Money::parse(' '))->toBeNull(); }); it('rejects amounts that are not euros with at most two decimals', function (string $typed) { Money::parse($typed); })->throws(InvalidMoneyAmount::class)->with(['-5', '1,234', 'abc', '1.000,00', '1000001']); it('formats with a no-break space and the currency', function () { $money = Money::fromCents(120050); expect($money->format())->toBe("1\u{00A0}200,50\u{00A0}€") ->and($money->inputValue())->toBe('1200,50'); });