From 361a1e8630fe76e829e44ee9bb4b28d19b1c068f 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 --- t/db_dependent/Circulation.t | 38 +++++++++++++++++++++++++++++++++++++- 1 files changed, 37 insertions(+), 1 deletions(-) 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.2.5