View | Details | Raw Unified | Return to bug 16768
Collapse All | Expand All

(-)a/t/Number/Price.t (-2 / +32 lines)
Lines 1-6 Link Here
1
use Modern::Perl;
1
use Modern::Perl;
2
2
3
use Test::More tests => 19;
3
use Test::More tests => 28;
4
4
5
use Test::MockModule;
5
use Test::MockModule;
6
use t::lib::Mocks;
6
use t::lib::Mocks;
Lines 75-77 is( Koha::Number::Price->new->unformat, '0', 'FR: unformat 0' ); Link Here
75
is( Koha::Number::Price->new(3)->unformat, '3', 'FR: unformat 3' );
75
is( Koha::Number::Price->new(3)->unformat, '3', 'FR: unformat 3' );
76
is( Koha::Number::Price->new(1234567890)->unformat,
76
is( Koha::Number::Price->new(1234567890)->unformat,
77
    '1234567890', 'FR: unformat 1234567890' );
77
    '1234567890', 'FR: unformat 1234567890' );
78
- 
78
79
# Price formatting for Switzerland: 1'234'567.89
80
t::lib::Mocks::mock_preference( 'CurrencyFormat', 'CH' );
81
$currency = Koha::Acquisition::Currency->new({
82
    currency => 'nnn',
83
    symbol   => 'CHF',
84
    rate     => 1,
85
    active   => 1,
86
});
87
88
is( Koha::Number::Price->new->format( $format ),    '0.00', 'CH: format 0' );
89
is( Koha::Number::Price->new(3)->format( $format ), '3.00', 'CH: format 3' );
90
is(
91
    Koha::Number::Price->new(1234567890)->format( $format ),
92
    '1\'234\'567\'890.00',
93
    'CHF: format 1234567890'
94
);
95
is( Koha::Number::Price->new->format( { %$format, with_symbol => 1 } ),
96
    'CHF0.00', 'CH: format 0 with symbol' );
97
is( Koha::Number::Price->new(3)->format( { %$format, with_symbol => 1 } ),
98
    'CHF3.00', 'CH: format 3 with symbol' );
99
is(
100
    Koha::Number::Price->new(1234567890)
101
      ->format( { %$format, with_symbol => 1 }, 'CH: format 123567890 with symbol' ),
102
    'CHF1\'234\'567\'890.00'
103
);
104
105
is( Koha::Number::Price->new->unformat,    '0', 'CHF: unformat 0' );
106
is( Koha::Number::Price->new(3)->unformat, '3', 'CHF: unformat 3' );
107
is( Koha::Number::Price->new(1234567890)->unformat,
108
    '1234567890', 'CHF: unformat 1234567890' );

Return to bug 16768