From 0e420a42124dbb2f1b3e767d8a34feaf1f1de552 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 1 Feb 2018 14:35:06 -0300 Subject: [PATCH] Bug 4078: Add a new test --- t/Number/Price.t | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/t/Number/Price.t b/t/Number/Price.t index 4b706b345e..1676c8a418 100644 --- a/t/Number/Price.t +++ b/t/Number/Price.t @@ -1,6 +1,6 @@ use Modern::Perl; -use Test::More tests => 31; +use Test::More tests => 32; use Test::MockModule; use t::lib::Mocks; @@ -18,7 +18,6 @@ use_ok('Koha::Number::Price'); my $orig_locale = setlocale(LC_NUMERIC); my $format = { p_cs_precedes => 1, # Force to place the symbol at the beginning - p_sep_by_space => 0, # Force to not add a space between the symbol and the number }; t::lib::Mocks::mock_preference( 'CurrencyFormat', 'US' ); $currency = Koha::Acquisition::Currency->new({ @@ -26,6 +25,7 @@ $currency = Koha::Acquisition::Currency->new({ symbol => '$', rate => 1, active => 1, + p_sep_by_space => 0, # Force to not add a space between the symbol and the number. This is the default behaviour }); is( Koha::Number::Price->new->format( $format ), '0.00', 'US: format 0' ); @@ -45,6 +45,10 @@ is( '$1,234,567,890.00' ); +$currency->p_sep_by_space(1); +is( Koha::Number::Price->new(3)->format( { %$format, with_symbol => 1 } ), + '$ 3.00', 'US: format 3 with symbol and a space' ); + is( Koha::Number::Price->new->unformat, '0', 'US: unformat 0' ); is( Koha::Number::Price->new(3)->unformat, '3', 'US: unformat 3' ); is( Koha::Number::Price->new(1234567890)->unformat, -- 2.11.0