Lines 19-25
Link Here
|
19 |
|
19 |
|
20 |
use Modern::Perl; |
20 |
use Modern::Perl; |
21 |
|
21 |
|
22 |
use Test::More tests => 20; |
22 |
use Test::More tests => 21; |
23 |
use Test::Warn; |
23 |
use Test::Warn; |
24 |
use DateTime; |
24 |
use DateTime; |
25 |
|
25 |
|
Lines 661-666
subtest 'holds' => sub {
Link Here
|
661 |
$patron->delete; |
661 |
$patron->delete; |
662 |
}; |
662 |
}; |
663 |
|
663 |
|
|
|
664 |
subtest 'status_not_ok' => sub { |
665 |
plan tests => 5; |
666 |
|
667 |
t::lib::Mocks::mock_preference('maxoutstanding', 5); |
668 |
my $patron = $builder->build( |
669 |
{ |
670 |
source => 'Borrower', |
671 |
value => { branchcode => $library->{branchcode}, |
672 |
gonenoaddress => 0, |
673 |
lost => 0, |
674 |
debarred => undef, |
675 |
debarredcomment => undef, |
676 |
dateexpiry => '9999-12-12' } |
677 |
} |
678 |
); |
679 |
|
680 |
$patron = Koha::Patrons->find($patron->{borrowernumber}); |
681 |
my $line = Koha::Account::Line->new({ |
682 |
borrowernumber => $patron->borrowernumber, |
683 |
amountoutstanding => 9001, |
684 |
})->store; |
685 |
my $outstanding = $patron->account->balance; |
686 |
my $maxoutstanding = C4::Context->preference('maxoutstanding'); |
687 |
my $expecting = 'Koha::Exceptions::Patron::Debt'; |
688 |
my @problems = $patron->status_not_ok; |
689 |
|
690 |
ok($maxoutstanding, 'When I look at system preferences, I see that maximum ' |
691 |
.'allowed outstanding fines is set.'); |
692 |
ok($maxoutstanding < $outstanding, 'When I check patron\'s balance, I found ' |
693 |
.'out they have more outstanding fines than allowed.'); |
694 |
is(scalar(@problems), 1, 'There is an issue with patron\'s current status'); |
695 |
my $debt = $problems[0]; |
696 |
is($debt->max_outstanding, 0+$maxoutstanding, 'Then I can see the status ' |
697 |
.'showing me how much outstanding total can be at maximum.'); |
698 |
is($debt->current_outstanding, 0+$outstanding, 'Then I can see the status ' |
699 |
.'showing me how much outstanding fines patron has right now.'); |
700 |
$patron->delete; |
701 |
}; |
702 |
|
664 |
$retrieved_patron_1->delete; |
703 |
$retrieved_patron_1->delete; |
665 |
is( Koha::Patrons->search->count, $nb_of_patrons + 1, 'Delete should have deleted the patron' ); |
704 |
is( Koha::Patrons->search->count, $nb_of_patrons + 1, 'Delete should have deleted the patron' ); |
666 |
|
705 |
|