From 5ca01fed115d9c4ef0fb9f8eb4c0b9138e9ffdad Mon Sep 17 00:00:00 2001 From: Janusz Kaczmarek Date: Tue, 1 Oct 2024 13:29:02 +0000 Subject: [PATCH] Bug 37511: Unit tests Signed-off-by: Roman Dolny Signed-off-by: Martin Renvoize --- t/Number/Price.t | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/t/Number/Price.t b/t/Number/Price.t index 9017fe793e5..d881750c174 100755 --- a/t/Number/Price.t +++ b/t/Number/Price.t @@ -1,6 +1,6 @@ use Modern::Perl; -use Test::More tests => 36; +use Test::More tests => 37; use Test::MockModule; use t::lib::Mocks; @@ -152,3 +152,30 @@ subtest 'Changes for format' => sub { # See also bug 18736 qr/\d\.\d{2}$/, 'This price still seems to be formatted' ); # Note that the comparison with MAX_INT is already subject to rounding }; + +subtest 'Changes for default currency symbol position' => sub { + plan tests => 2; + + t::lib::Mocks::mock_preference( 'CurrencyFormat', 'FR' ); + $currency = Koha::Acquisition::Currency->new( + { + currency => 'PLN', + symbol => 'zł', + rate => 1, + active => 1, + p_sep_by_space => 1, + p_cs_precedes => 1, + } + ); + is( + Koha::Number::Price->new('123456.78')->format( { with_symbol => 1 } ), + 'zł 123 456,78', + 'PLN: format 123 456,78 with symbol before' + ); + $currency->p_cs_precedes(0); + is( + Koha::Number::Price->new('123456.78')->format( { with_symbol => 1 } ), + '123 456,78 zł', + 'PLN: format 123 456,78 with symbol after' + ); +}; -- 2.47.0