Lines 20-26
subtest 'Tests from t' => sub {
Link Here
|
20 |
t::lib::Mocks::mock_preference( 'TaxRates', '0.02|0.05|0.196' ); |
20 |
t::lib::Mocks::mock_preference( 'TaxRates', '0.02|0.05|0.196' ); |
21 |
my $bookseller_module = Test::MockModule->new('Koha::Acquisition::Bookseller'); |
21 |
my $bookseller_module = Test::MockModule->new('Koha::Acquisition::Bookseller'); |
22 |
|
22 |
|
23 |
my ( @booksellers, @baskets ); |
23 |
my ( @booksellers, @baskets, @biblios ); |
24 |
my @names = ( '0 0', '0 1', '1 0', '1 1' ); |
24 |
my @names = ( '0 0', '0 1', '1 0', '1 1' ); |
25 |
foreach my $i ( 1..4 ) { |
25 |
foreach my $i ( 1..4 ) { |
26 |
push @booksellers, $builder->build_object( |
26 |
push @booksellers, $builder->build_object( |
Lines 37-42
subtest 'Tests from t' => sub {
Link Here
|
37 |
{ basketname => $names[ $i - 1 ], booksellerid => $booksellers[$i-1]->id } |
37 |
{ basketname => $names[ $i - 1 ], booksellerid => $booksellers[$i-1]->id } |
38 |
} |
38 |
} |
39 |
); |
39 |
); |
|
|
40 |
push @biblios, $builder->build_sample_biblio; |
40 |
} |
41 |
} |
41 |
|
42 |
|
42 |
my ( $basketno_0_0, $basketno_0_1, $basketno_1_0, $basketno_1_1 ) = map { $_->id } @baskets; |
43 |
my ( $basketno_0_0, $basketno_0_1, $basketno_1_0, $basketno_1_1 ) = map { $_->id } @baskets; |
Lines 48-54
subtest 'Tests from t' => sub {
Link Here
|
48 |
subtest 'Configuration 1: 0 0 (Vendor List prices do not include tax / Invoice prices do not include tax)' => sub { |
49 |
subtest 'Configuration 1: 0 0 (Vendor List prices do not include tax / Invoice prices do not include tax)' => sub { |
49 |
plan tests => 8; |
50 |
plan tests => 8; |
50 |
|
51 |
|
51 |
my $biblionumber_0_0 = 42; |
52 |
my $biblionumber_0_0 = $biblios[0]->id; |
52 |
|
53 |
|
53 |
my $order_0_0 = Koha::Acquisition::Order->new({ |
54 |
my $order_0_0 = Koha::Acquisition::Order->new({ |
54 |
biblionumber => $biblionumber_0_0, |
55 |
biblionumber => $biblionumber_0_0, |
Lines 139-145
subtest 'Tests from t' => sub {
Link Here
|
139 |
subtest 'Configuration 1: 1 1 (Vendor List prices do include tax / Invoice prices include tax)' => sub { |
140 |
subtest 'Configuration 1: 1 1 (Vendor List prices do include tax / Invoice prices include tax)' => sub { |
140 |
plan tests => 11; |
141 |
plan tests => 11; |
141 |
|
142 |
|
142 |
my $biblionumber_1_1 = 43; |
143 |
my $biblionumber_1_1 = $biblios[3]->id; |
143 |
my $order_1_1 = Koha::Acquisition::Order->new({ |
144 |
my $order_1_1 = Koha::Acquisition::Order->new({ |
144 |
biblionumber => $biblionumber_1_1, |
145 |
biblionumber => $biblionumber_1_1, |
145 |
quantity => 2, |
146 |
quantity => 2, |
Lines 276-282
subtest 'Tests from t' => sub {
Link Here
|
276 |
subtest 'Configuration 1: 1 0 (Vendor List prices include tax / Invoice prices do not include tax)' => sub { |
277 |
subtest 'Configuration 1: 1 0 (Vendor List prices include tax / Invoice prices do not include tax)' => sub { |
277 |
plan tests => 9; |
278 |
plan tests => 9; |
278 |
|
279 |
|
279 |
my $biblionumber_1_0 = 44; |
280 |
my $biblionumber_1_0 = $biblios[2]->id; |
280 |
my $order_1_0 = Koha::Acquisition::Order->new({ |
281 |
my $order_1_0 = Koha::Acquisition::Order->new({ |
281 |
biblionumber => $biblionumber_1_0, |
282 |
biblionumber => $biblionumber_1_0, |
282 |
quantity => 2, |
283 |
quantity => 2, |
Lines 381-387
subtest 'Tests from t' => sub {
Link Here
|
381 |
subtest 'Configuration 1: 0 1 (Vendor List prices do not include tax / Invoice prices include tax)' => sub { |
382 |
subtest 'Configuration 1: 0 1 (Vendor List prices do not include tax / Invoice prices include tax)' => sub { |
382 |
plan tests => 9; |
383 |
plan tests => 9; |
383 |
|
384 |
|
384 |
my $biblionumber_0_1 = 45; |
385 |
my $biblionumber_0_1 = $biblios[1]->id; |
385 |
my $order_0_1 = Koha::Acquisition::Order->new({ |
386 |
my $order_0_1 = Koha::Acquisition::Order->new({ |
386 |
biblionumber => $biblionumber_0_1, |
387 |
biblionumber => $biblionumber_0_1, |
387 |
quantity => 2, |
388 |
quantity => 2, |
Lines 488-502
subtest 'Tests from t' => sub {
Link Here
|
488 |
is( |
489 |
is( |
489 |
Koha::Number::Price->new( $params->{got} )->format, |
490 |
Koha::Number::Price->new( $params->{got} )->format, |
490 |
Koha::Number::Price->new( $params->{expected} )->format, |
491 |
Koha::Number::Price->new( $params->{expected} )->format, |
491 |
"configuration $params->{conf}: $params->{field} should be correctly calculated" |
492 |
"configuration $params->{conf}: $params->{field} should be correctly calculated" |
492 |
); |
493 |
); |
493 |
} |
494 |
} |
494 |
|
495 |
|
495 |
# format_for_editing |
496 |
# format_for_editing |
496 |
for my $currency_format ( qw( US FR ) ) { |
497 |
for my $currency_format (qw( US FR )) { |
497 |
t::lib::Mocks::mock_preference( 'CurrencyFormat', $currency_format ); |
498 |
t::lib::Mocks::mock_preference( 'CurrencyFormat', $currency_format ); |
498 |
is( Koha::Number::Price->new( 1234567 )->format_for_editing, '1234567.00', 'format_for_editing should return unformated integer part with 2 decimals' ); |
499 |
is( |
499 |
is( Koha::Number::Price->new( 1234567.89 )->format_for_editing, '1234567.89', 'format_for_editing should return unformated integer part with 2 decimals' ); |
500 |
Koha::Number::Price->new(1234567)->format_for_editing, '1234567.00', |
|
|
501 |
'format_for_editing should return unformated integer part with 2 decimals' |
502 |
); |
503 |
is( |
504 |
Koha::Number::Price->new(1234567.89)->format_for_editing, '1234567.89', |
505 |
'format_for_editing should return unformated integer part with 2 decimals' |
506 |
); |
500 |
} |
507 |
} |
501 |
}; |
508 |
}; |
502 |
|
509 |
|
503 |
- |
|
|