|
Lines 18-24
Link Here
|
| 18 |
use Modern::Perl; |
18 |
use Modern::Perl; |
| 19 |
use utf8; |
19 |
use utf8; |
| 20 |
|
20 |
|
| 21 |
use Test::More tests => 130; |
21 |
use Test::More tests => 131; |
| 22 |
use Test::MockModule; |
22 |
use Test::MockModule; |
| 23 |
|
23 |
|
| 24 |
use Data::Dumper; |
24 |
use Data::Dumper; |
|
Lines 2550-2555
subtest '_FixOverduesOnReturn' => sub {
Link Here
|
| 2550 |
is( $credit->amountoutstanding + 0, 0, "Credit amountoutstanding is correctly set to 0" ); |
2550 |
is( $credit->amountoutstanding + 0, 0, "Credit amountoutstanding is correctly set to 0" ); |
| 2551 |
}; |
2551 |
}; |
| 2552 |
|
2552 |
|
|
|
2553 |
subtest '_FixAccountForLostAndReturned returns undef if patron is deleted' => sub { |
| 2554 |
plan tests => 1; |
| 2555 |
|
| 2556 |
my $manager = $builder->build_object({ class => "Koha::Patrons" }); |
| 2557 |
t::lib::Mocks::mock_userenv({ patron => $manager, branchcode => $manager->branchcode }); |
| 2558 |
|
| 2559 |
my $biblio = $builder->build_sample_biblio({ author => 'Hall, Kylie' }); |
| 2560 |
|
| 2561 |
my $branchcode = $library2->{branchcode}; |
| 2562 |
|
| 2563 |
my $item = $builder->build_sample_item( |
| 2564 |
{ |
| 2565 |
biblionumber => $biblio->biblionumber, |
| 2566 |
library => $branchcode, |
| 2567 |
replacementprice => 99.00, |
| 2568 |
itype => $itemtype, |
| 2569 |
} |
| 2570 |
); |
| 2571 |
|
| 2572 |
my $patron = $builder->build_object( { class => 'Koha::Patrons' } ); |
| 2573 |
|
| 2574 |
## Start with basic call, should just close out the open fine |
| 2575 |
my $accountline = Koha::Account::Line->new( |
| 2576 |
{ |
| 2577 |
borrowernumber => $patron->id, |
| 2578 |
accounttype => 'L', |
| 2579 |
status => undef, |
| 2580 |
itemnumber => $item->itemnumber, |
| 2581 |
amount => 99.00, |
| 2582 |
amountoutstanding => 99.00, |
| 2583 |
interface => 'test', |
| 2584 |
} |
| 2585 |
)->store(); |
| 2586 |
|
| 2587 |
$patron->delete(); |
| 2588 |
|
| 2589 |
my $return_value = C4::Circulation::_FixAccountForLostAndReturned( $patron->id, $item->itemnumber ); |
| 2590 |
|
| 2591 |
is( $return_value, undef, "_FixAccountForLostAndReturned returns undef if patron is deleted" ); |
| 2592 |
|
| 2593 |
}; |
| 2594 |
|
| 2553 |
subtest 'Set waiting flag' => sub { |
2595 |
subtest 'Set waiting flag' => sub { |
| 2554 |
plan tests => 4; |
2596 |
plan tests => 4; |
| 2555 |
|
2597 |
|
| 2556 |
- |
|
|