1
0
Fork 0
mirror of https://github.com/archtechx/money.git synced 2025-12-12 11:24:03 +00:00

addDecimal() and subtractDecimal()

This commit is contained in:
Samuel Štancl 2021-11-28 18:47:59 +01:00
parent b6b94e0530
commit c6ef5aa54c
2 changed files with 35 additions and 4 deletions

View file

@ -225,6 +225,16 @@ test('the cents from the decimal value can be fetched using the cents method', f
expect(money(123456789, CZK::class)->cents()->value())->toBe(89);
});
test('decimal values can be added and subtracted', function () {
expect(
money(1234)->addDecimal(21.3)->value()
)->toBe(3364);
expect(
money(1234)->subtractDecimal(8.3)->value()
)->toBe(404);
});
test('money can be serialized to JSON', function () {
currencies()->add(CZK::class);