Lines 1-6
Link Here
|
1 |
use Modern::Perl; |
1 |
use Modern::Perl; |
2 |
|
2 |
|
3 |
use Test::More tests => 33; |
3 |
use Test::More tests => 34; |
4 |
|
4 |
|
5 |
use Test::MockModule; |
5 |
use Test::MockModule; |
6 |
use t::lib::Mocks; |
6 |
use t::lib::Mocks; |
Lines 134-136
is( Koha::Number::Price->new->unformat, '0', 'CHF: unformat 0' );
Link Here
|
134 |
is( Koha::Number::Price->new(3)->unformat, '3', 'CHF: unformat 3' ); |
134 |
is( Koha::Number::Price->new(3)->unformat, '3', 'CHF: unformat 3' ); |
135 |
is( Koha::Number::Price->new(1234567890)->unformat, |
135 |
is( Koha::Number::Price->new(1234567890)->unformat, |
136 |
'1234567890', 'CHF: unformat 1234567890' ); |
136 |
'1234567890', 'CHF: unformat 1234567890' ); |
137 |
- |
137 |
|
|
|
138 |
subtest 'Changes for format' => sub { # See also bug 18736 |
139 |
plan tests => 3; |
140 |
|
141 |
t::lib::Mocks::mock_preference( 'CurrencyFormat', 'US' ); |
142 |
|
143 |
is( Koha::Number::Price->new(-2.125)->format, "-2.13", "Check negative value" ); |
144 |
my $large_number = 2**53; # MAX_INT |
145 |
my $price = Koha::Number::Price->new($large_number); |
146 |
is( $price->format, $price->value, 'Format '.$price->value.' returns value' ); |
147 |
like( Koha::Number::Price->new( 2**53/100 )->format, |
148 |
qr/\d\.\d{2}$/, 'This price still seems to be formatted' ); |
149 |
# Note that the comparison with MAX_INT is already subject to rounding |
150 |
}; |