From 998d42fc5c762a3a5782120bd4303ab486b6a6b2 Mon Sep 17 00:00:00 2001
From: Nick Clemens <nick@bywatersolutions.com>
Date: Thu, 10 Aug 2017 15:20:19 +0000
Subject: [PATCH] Bug 19076 - unit tests
---
t/db_dependent/Circulation.t | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/t/db_dependent/Circulation.t b/t/db_dependent/Circulation.t
index 9319924..1d35426 100755
--- a/t/db_dependent/Circulation.t
+++ b/t/db_dependent/Circulation.t
@@ -17,7 +17,7 @@
use Modern::Perl;
-use Test::More tests => 96;
+use Test::More tests => 98;
use DateTime;
@@ -455,7 +455,7 @@ C4::Context->dbh->do("DELETE FROM accountlines");
$biblionumber
);
my $datedue6 = AddIssue( $renewing_borrower, $barcode6);
- is (defined $datedue6, 1, "Item 2 checked out, due date: $datedue6");
+ is (defined $datedue6, 1, "Item 2 checked out, due date: ".$datedue6->date_due);
my $now = dt_from_string();
my $five_weeks = DateTime::Duration->new(weeks => 5);
@@ -489,6 +489,16 @@ C4::Context->dbh->do("DELETE FROM accountlines");
$new_log_size = scalar(@{GetLogs( $date, $date, undef,["CIRCULATION"], ["RENEWAL"]) } );
is ($new_log_size, $old_log_size + 1, 'renew log successfully added');
+ my $old_issue_log_size = scalar(@{GetLogs( $date, $date, undef,["CIRCULATION"], ["ISSUE"]) } );
+ my $old_renew_log_size = scalar(@{GetLogs( $date, $date, undef,["CIRCULATION"], ["RENEWAL"]) } );
+ print $datedue6->date_due."\n";
+ AddIssue( $renewing_borrower,$barcode7,Koha::DateUtils::output_pref({str=>$datedue6->date_due, dateformat =>'iso'}),0,$date, 0, undef );
+ $new_log_size = scalar(@{GetLogs( $date, $date, undef,["CIRCULATION"], ["RENEWAL"]) } );
+ is ($new_log_size, $old_renew_log_size + 1, 'renew log successfully added when renewed via issuing');
+ $new_log_size = scalar(@{GetLogs( $date, $date, undef,["CIRCULATION"], ["ISSUE"]) } );
+ is ($new_log_size, $old_issue_log_size, 'renew not logged as issue when renewed via issuing');
+
+
$fine = $schema->resultset('Accountline')->single( { borrowernumber => $renewing_borrower->{borrowernumber}, itemnumber => $itemnumber7 } );
is( $fine->accounttype, 'F', 'Fine on renewed item is closed out properly' );
--
2.1.4