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:
parent
39cc13d070
commit
1ca7b6c40c
|
|
@ -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');
|
||||
|
|
|
|||
Loading…
Reference in New Issue