From 04c3ba748d743a5e2a1e044421138b26b44d10d8 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Mon, 16 Mar 2015 10:15:54 -0400 Subject: [PATCH] Bug 13841 - Unit Test Signed-off-by: Jen DeMuth --- t/db_dependent/Circulation.t | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/t/db_dependent/Circulation.t b/t/db_dependent/Circulation.t index d020d24..4741c4c 100755 --- a/t/db_dependent/Circulation.t +++ b/t/db_dependent/Circulation.t @@ -23,10 +23,11 @@ use C4::Branch; use C4::Items; use C4::Members; use C4::Reserves; +use C4::Overdues qw(UpdateFine); use Koha::DateUtils; use Koha::Database; -use Test::More tests => 59; +use Test::More tests => 60; BEGIN { use_ok('C4::Circulation'); @@ -539,6 +540,41 @@ C4::Context->dbh->do("DELETE FROM accountlines"); } +{ + my $barcode = '1234567890'; + my $branch = 'MPL'; + + my $biblio = MARC::Record->new(); + my ($biblionumber, $biblioitemnumber) = AddBiblio($biblio, ''); + + #Create third item + my ( undef, undef, $itemnumber ) = AddItem( + { + homebranch => $branch, + holdingbranch => $branch, + barcode => $barcode + }, + $biblionumber + ); + + # Create a borrower + my %a_borrower_data = ( + firstname => 'Kyle', + surname => 'Hall', + categorycode => 'S', + branchcode => $branch, + ); + + my $borrowernumber = AddMember(%a_borrower_data); + + UpdateFine( $itemnumber, $borrowernumber, 0 ); + + my $hr = $dbh->selectrow_hashref(q{SELECT COUNT(*) AS count FROM accountlines WHERE borrowernumber = ? AND itemnumber = ?}, undef, $borrowernumber, $itemnumber ); + my $count = $hr->{count}; + + is ( $count, 0, "Calling UpdateFine on non-existant fine with an amount of 0 does not result in an empty fine" ); +} + $dbh->rollback; 1; -- 1.7.10.4