Browse Source

Bug 4078: Add a new test

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
18.05.x
Jonathan Druart 4 years ago
parent
commit
f2cf899a90
  1. 8
      t/Number/Price.t

8
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,

Loading…
Cancel
Save