|
Lines 2-7
Link Here
|
| 2 |
|
2 |
|
| 3 |
use Modern::Perl; |
3 |
use Modern::Perl; |
| 4 |
use Test::More tests => 17; |
4 |
use Test::More tests => 17; |
|
|
5 |
use Test::Warn; |
| 5 |
|
6 |
|
| 6 |
use C4::Context; |
7 |
use C4::Context; |
| 7 |
use Koha::Database; |
8 |
use Koha::Database; |
|
Lines 132-138
$schema->storage->txn_rollback;
Link Here
|
| 132 |
|
133 |
|
| 133 |
subtest 'UpdateFine tests' => sub { |
134 |
subtest 'UpdateFine tests' => sub { |
| 134 |
|
135 |
|
| 135 |
plan tests => 74; |
136 |
plan tests => 75; |
| 136 |
|
137 |
|
| 137 |
$schema->storage->txn_begin; |
138 |
$schema->storage->txn_begin; |
| 138 |
|
139 |
|
|
Lines 536-540
subtest 'UpdateFine tests' => sub {
Link Here
|
| 536 |
my $refunds = Koha::Account::Lines->search({ itemnumber => $item_2->itemnumber, credit_type_code => 'OVERPAYMENT' }); |
537 |
my $refunds = Koha::Account::Lines->search({ itemnumber => $item_2->itemnumber, credit_type_code => 'OVERPAYMENT' }); |
| 537 |
is( $refunds->count, 0, "Overpayment refund not added when the amounts are equal" ); |
538 |
is( $refunds->count, 0, "Overpayment refund not added when the amounts are equal" ); |
| 538 |
|
539 |
|
|
|
540 |
# Adding an OVERDUE fine not linked with a checkout (possible with historical OVERDUE fines) |
| 541 |
$builder->build_object( |
| 542 |
{ |
| 543 |
class => "Koha::Account::Lines", |
| 544 |
value => { |
| 545 |
borrowernumber => $patron_1->borrowernumber, |
| 546 |
issue_id => undef, |
| 547 |
debit_type_code => 'OVERDUE', |
| 548 |
} |
| 549 |
} |
| 550 |
); |
| 551 |
$fine->issue_id(undef)->store; |
| 552 |
warnings_are { |
| 553 |
UpdateFine( |
| 554 |
{ |
| 555 |
issue_id => $checkout_2->issue_id, |
| 556 |
itemnumber => $item_2->itemnumber, |
| 557 |
borrowernumber => $patron_1->borrowernumber, |
| 558 |
amount => $amount, |
| 559 |
due => $checkout_2->date_due |
| 560 |
} |
| 561 |
); |
| 562 |
} [], 'No warning generated if fine is not linked with a checkout'; |
| 563 |
|
| 539 |
$schema->storage->txn_rollback; |
564 |
$schema->storage->txn_rollback; |
| 540 |
}; |
565 |
}; |
| 541 |
- |
|
|