Bug 24075: Unit tests

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
Kyle M Hall 2019-11-21 06:34:11 -05:00 committed by Martin Renvoize
parent 39cc13d070
commit 1ca7b6c40c
No known key found for this signature in database
GPG Key ID: 422B469130441A0F
1 changed files with 44 additions and 1 deletions

View File

@ -18,7 +18,7 @@
use Modern::Perl;
use utf8;
use Test::More tests => 45;
use Test::More tests => 46;
use Test::MockModule;
use Data::Dumper;
@ -3341,6 +3341,49 @@ subtest 'CanBookBeIssued & RentalFeesCheckoutConfirmation' => sub {
$itemtype->rentalcharge_daily('0')->store;
};
subtest "Test Backdating of Returns" => sub {
plan tests => 2;
my $branch = $library2->{branchcode};
my $biblio = $builder->build_sample_biblio();
my $item = $builder->build_sample_item(
{
biblionumber => $biblio->biblionumber,
library => $branch,
itype => $itemtype,
}
);
my %a_borrower_data = (
firstname => 'Kyle',
surname => 'Hall',
categorycode => $patron_category->{categorycode},
branchcode => $branch,
);
my $borrowernumber = Koha::Patron->new(\%a_borrower_data)->store->borrowernumber;
my $borrower = Koha::Patrons->find( $borrowernumber )->unblessed;
my $due_date = dt_from_string;
my $issue = AddIssue( $borrower, $item->barcode, $due_date );
UpdateFine(
{
issue_id => $issue->id(),
itemnumber => $item->itemnumber,
borrowernumber => $borrowernumber,
amount => .25,
amountoutstanding => .25,
type => q{}
}
);
my ( undef, $message ) = AddReturn( $item->barcode, $branch, undef, $due_date );
my $accountline = Koha::Account::Lines->find( { issue_id => $issue->id } );
is( $accountline->amountoutstanding, '0.000000', 'Fee amount outstanding was reduced to 0' );
is( $accountline->amount, '0.000000', 'Fee amount was reduced to 0' );
};
$schema->storage->txn_rollback;
C4::Context->clear_syspref_cache();
$cache->clear_from_cache('single_holidays');