Bug 14337: Add 2 more tests to be complete

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Jonathan Druart 2015-08-25 12:47:57 +01:00 committed by Tomas Cohen Arazi
parent a2844a8a5c
commit 9f0170668c

View file

@ -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 = 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);