From 7e16f58668a10365ed1a8aa862cdbfc89b400f7d Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Thu, 15 Aug 2013 22:17:37 +0000 Subject: [PATCH] Bug 10663: (follow-up) set circ policy for circulation tests This patch ensures that the loan rules are set to a known value suitable for testing. Signed-off-by: Galen Charlton (cherry picked from commit 51b8deb4d5eceee84ad95b28cac902330b4b12fe) Signed-off-by: Tomas Cohen Arazi --- t/db_dependent/Circulation.t | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/t/db_dependent/Circulation.t b/t/db_dependent/Circulation.t index 023c767151..bf27fb5fc8 100755 --- a/t/db_dependent/Circulation.t +++ b/t/db_dependent/Circulation.t @@ -124,6 +124,23 @@ is( 'CircControl reset to its initial value' ); +# Set a simple circ policy +$dbh->do('DELETE FROM issuingrules'); +$dbh->do( + q{INSERT INTO issuingrules (categorycode, branchcode, itemtype, reservesallowed, + maxissueqty, issuelength, lengthunit, + renewalsallowed, renewalperiod) + VALUES (?, ?, ?, ?, + ?, ?, ?, + ?, ? + ) + }, + {}, + '*', '*', '*', 25, + 20, 14, 'days', + 1, 7 +); + # Test C4::Circulation::ProcessOfflinePayment my $sth = C4::Context->dbh->prepare("SELECT COUNT(*) FROM accountlines WHERE amount = '-123.45' AND accounttype = 'Pay'"); $sth->execute(); @@ -255,10 +272,10 @@ C4::Context->dbh->do("DELETE FROM borrowers WHERE cardnumber = '99999999999'"); $reserveid = C4::Reserves::GetReserveId({ biblionumber => $biblionumber, itemnumber => $itemnumber, borrowernumber => $reserving_borrowernumber}); CancelReserve({ reserve_id => $reserveid }); - diag("Too many renewals"); - # FIXME: Check with circulation rules and renewalsallowed set properly configured + # set policy to forbid renewals + $dbh->do('UPDATE issuingrules SET renewalsallowed = 0'); ( $renewokay, $error ) = CanBookBeRenewed($renewing_borrowernumber, $itemnumber); is( $renewokay, 0, 'Cannot renew, 0 renewals allowed'); -- 2.39.5