Bugzilla – Attachment 41708 Details for
Bug 14337
AllowRenewalIfOtherItemsAvailable counts holdable not for loan items when checking renewability
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 14337 - Add Unit Tests
Bug-14337---Add-Unit-Tests.patch (text/plain), 4.16 KB, created by
Kyle M Hall (khall)
on 2015-08-20 11:16:36 UTC
(
hide
)
Description:
Bug 14337 - Add Unit Tests
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2015-08-20 11:16:36 UTC
Size:
4.16 KB
patch
obsolete
>From a7ce8c0608ae516aa925042d85583f9778f167f0 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Thu, 20 Aug 2015 06:46:51 -0400 >Subject: [PATCH] Bug 14337 - Add Unit Tests > >--- > t/db_dependent/Circulation.t | 86 ++++++++++++++++++++++++++++++++++++++++- > 1 files changed, 83 insertions(+), 3 deletions(-) > >diff --git a/t/db_dependent/Circulation.t b/t/db_dependent/Circulation.t >index 30a5fe7..6236d39 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 => 61; >+use Test::More tests => 65; > > BEGIN { > use_ok('C4::Circulation'); >@@ -37,8 +37,8 @@ my $dbh = C4::Context->dbh; > my $schema = Koha::Database->new()->schema(); > > # Start transaction >-$dbh->{AutoCommit} = 0; > $dbh->{RaiseError} = 1; >+$schema->storage->txn_begin(); > > # Start with a clean slate > $dbh->do('DELETE FROM issues'); >@@ -594,6 +594,86 @@ C4::Context->dbh->do("DELETE FROM accountlines"); > is ( $count, 0, "Calling UpdateFine on non-existant fine with an amount of 0 does not result in an empty fine" ); > } > >-$dbh->rollback; >+{ >+ $dbh->do('DELETE FROM issues'); >+ $dbh->do('DELETE FROM items'); >+ $dbh->do('DELETE FROM issuingrules'); >+ $dbh->do( >+ q{ >+ INSERT INTO issuingrules ( categorycode, branchcode, itemtype, reservesallowed, maxissueqty, issuelength, lengthunit, renewalsallowed, renewalperiod, >+ norenewalbefore, auto_renew, fine, chargeperiod ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? ) >+ }, >+ {}, >+ '*', '*', '*', 25, >+ 20, 14, 'days', >+ 1, 7, >+ '', 0, >+ .10, 1 >+ ); >+ my $biblio = MARC::Record->new(); >+ my ( $biblionumber, $biblioitemnumber ) = AddBiblio( $biblio, '' ); >+ >+ my $barcode1 = '1234'; >+ my ( undef, undef, $itemnumber1 ) = AddItem( >+ { >+ homebranch => 'MPL', >+ holdingbranch => 'MPL', >+ barcode => $barcode1, >+ }, >+ $biblionumber >+ ); >+ my $barcode2 = '4321'; >+ my ( undef, undef, $itemnumber2 ) = AddItem( >+ { >+ homebranch => 'MPL', >+ holdingbranch => 'MPL', >+ barcode => $barcode2, >+ }, >+ $biblionumber >+ ); >+ >+ my $borrowernumber1 = AddMember( >+ firstname => 'Kyle', >+ surname => 'Hall', >+ categorycode => 'S', >+ branchcode => 'MPL', >+ ); >+ my $borrowernumber2 = AddMember( >+ firstname => 'Chelsea', >+ surname => 'Hall', >+ categorycode => 'S', >+ branchcode => 'MPL', >+ ); >+ >+ my $borrower1 = GetMember( borrowernumber => $borrowernumber1 ); >+ my $borrower2 = GetMember( borrowernumber => $borrowernumber2 ); >+ >+ my $issue = AddIssue( $borrower1, $barcode1 ); >+ >+ my ( $renewokay, $error ) = CanBookBeRenewed( $borrowernumber2, $itemnumber1 ); >+ is( $renewokay, 1, 'Bug 14337 - Verify the borrower can renew with no hold on the record' ); >+ >+ AddReserve( >+ 'MPL', $borrowernumber2, $biblionumber, >+ 'a', '', 1, undef, undef, '', >+ undef, undef, undef >+ ); >+ >+ ( $renewokay, $error ) = CanBookBeRenewed( $borrowernumber2, $itemnumber1 ); >+ is( $renewokay, 0, 'Bug 14337 - Verify the borrower cannot renew with a hold on the record' ); >+ >+ C4::Context->dbh->do("UPDATE issuingrules SET onshelfholds = 1"); >+ C4::Context->set_preference( 'AllowRenewalIfOtherItemsAvailable', 1 ); >+ >+ ( $renewokay, $error ) = CanBookBeRenewed( $borrowernumber2, $itemnumber1 ); >+ is( $renewokay, 1, 'Bug 14337 - Verify the borrower can renew with a hold on the record if AllowRenewalIfOtherItemsAvailable is enabled' ); >+ >+ diag("Setting item not checked out to be not for loan but holdable"); >+ ModItem({ notforloan => -1 }, $biblionumber, $itemnumber2); >+ >+ ( $renewokay, $error ) = CanBookBeRenewed( $borrowernumber2, $itemnumber1 ); >+ is( $renewokay, 0, 'Bug 14337 - Verify the borrower can not renew with a hold on the record if AllowRenewalIfOtherItemsAvailable is enabled but the only available item is notforloan' ); >+} > >+$schema->storage->txn_rollback(); > 1; >-- >1.7.2.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 14337
:
39898
|
41262
|
41263
|
41569
|
41708
|
41709
|
41787
|
41788
|
41904
|
41905
|
41906
|
41907
|
50840
|
50841