From 01944ba2edc969f639380abf3d8d93013b42385a Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 25 Aug 2015 12:47:57 +0100 Subject: [PATCH] Bug 14337: Add 2 more tests to be complete Signed-off-by: Jonathan Druart --- t/db_dependent/Circulation.t | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/t/db_dependent/Circulation.t b/t/db_dependent/Circulation.t index c1b4b08..591c7e4 100755 --- a/t/db_dependent/Circulation.t +++ b/t/db_dependent/Circulation.t @@ -27,7 +27,7 @@ use C4::Overdues qw(UpdateFine); use Koha::DateUtils; use Koha::Database; -use Test::More tests => 65; +use Test::More tests => 67; BEGIN { use_ok('C4::Circulation'); @@ -658,14 +658,25 @@ C4::Context->dbh->do("DELETE FROM accountlines"); undef, undef, undef ); + C4::Context->dbh->do("UPDATE issuingrules SET onshelfholds = 0"); + C4::Context->set_preference( 'AllowRenewalIfOtherItemsAvailable', 0 ); ( $renewokay, $error ) = CanBookBeRenewed( $borrowernumber1, $itemnumber1 ); - is( $renewokay, 0, 'Bug 14337 - Verify the borrower cannot renew with a hold on the record' ); + is( $renewokay, 0, 'Bug 14337 - Verify the borrower cannot renew with a hold on the record if AllowRenewalIfOtherItemsAvailable and onshelfholds are disabled' ); - C4::Context->dbh->do("UPDATE issuingrules SET onshelfholds = 1"); + C4::Context->dbh->do("UPDATE issuingrules SET onshelfholds = 0"); C4::Context->set_preference( 'AllowRenewalIfOtherItemsAvailable', 1 ); + ( $renewokay, $error ) = CanBookBeRenewed( $borrowernumber1, $itemnumber1 ); + is( $renewokay, 0, 'Bug 14337 - Verify the borrower cannot renew with a hold on the record if AllowRenewalIfOtherItemsAvailable is enabled and onshelfholds is disabled' ); + C4::Context->dbh->do("UPDATE issuingrules SET onshelfholds = 1"); + C4::Context->set_preference( 'AllowRenewalIfOtherItemsAvailable', 0 ); + ( $renewokay, $error ) = CanBookBeRenewed( $borrowernumber1, $itemnumber1 ); + is( $renewokay, 0, 'Bug 14337 - Verify the borrower cannot renew with a hold on the record if AllowRenewalIfOtherItemsAvailable is disabled and onshelfhold is enabled' ); + + C4::Context->dbh->do("UPDATE issuingrules SET onshelfholds = 1"); + C4::Context->set_preference( 'AllowRenewalIfOtherItemsAvailable', 1 ); ( $renewokay, $error ) = CanBookBeRenewed( $borrowernumber1, $itemnumber1 ); - is( $renewokay, 1, 'Bug 14337 - Verify the borrower can renew with a hold on the record if AllowRenewalIfOtherItemsAvailable is enabled' ); + is( $renewokay, 1, 'Bug 14337 - Verify the borrower can renew with a hold on the record if AllowRenewalIfOtherItemsAvailable and onshelfhold are enabled' ); # Setting item not checked out to be not for loan but holdable ModItem({ notforloan => -1 }, $biblionumber, $itemnumber2); -- 2.1.0