From 955e39f661070c8ed28b130f844f06cdbd7bbc18 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 Signed-off-by: Katrin Fischer --- 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 9017fe793e..d881750c17 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.39.5