Bugzilla – Attachment 35257 Details for
Bug 12632
Hold limits ignored for record level holds with item level itemtypes
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 12632 - Unit Tests
Bug-12632---Unit-Tests.patch (text/plain), 3.12 KB, created by
Kyle M Hall (khall)
on 2015-01-14 16:45:31 UTC
(
hide
)
Description:
Bug 12632 - Unit Tests
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2015-01-14 16:45:31 UTC
Size:
3.12 KB
patch
obsolete
>From fc6dc3e6db74abebe7a2fd7598d50ffc77c33c5b Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Wed, 14 Jan 2015 11:42:29 -0500 >Subject: [PATCH] Bug 12632 - Unit Tests > >--- > t/db_dependent/Holds.t | 38 +++++++++++++++++++++++++++++++++----- > 1 files changed, 33 insertions(+), 5 deletions(-) > >diff --git a/t/db_dependent/Holds.t b/t/db_dependent/Holds.t >index 4aee01b..4ba114b 100755 >--- a/t/db_dependent/Holds.t >+++ b/t/db_dependent/Holds.t >@@ -6,7 +6,7 @@ use t::lib::Mocks; > use C4::Context; > use C4::Branch; > >-use Test::More tests => 38; >+use Test::More tests => 40; > use MARC::Record; > use C4::Biblio; > use C4::Items; >@@ -34,6 +34,7 @@ my $insert_sth = $dbh->prepare('INSERT INTO itemtypes (itemtype) VALUES (?)'); > $insert_sth->execute('CAN'); > $insert_sth->execute('CANNOT'); > $insert_sth->execute('DUMMY'); >+$insert_sth->execute('ONLY1'); > > # Setup Test------------------------ > # Create a biblio instance for testing >@@ -193,19 +194,25 @@ my ($foreign_item_bibnum, $foreign_item_bibitemnum, $foreign_itemnumber) > $dbh->do('DELETE FROM issuingrules'); > $dbh->do( > q{INSERT INTO issuingrules (categorycode, branchcode, itemtype, reservesallowed) >- VALUES (?, ?, ?, ?)}, >+ VALUES (?, ?, ?, ?)}, > {}, > '*', '*', '*', 25 > ); > $dbh->do( > q{INSERT INTO issuingrules (categorycode, branchcode, itemtype, reservesallowed) >- VALUES (?, ?, ?, ?)}, >+ VALUES (?, ?, ?, ?)}, > {}, >- '*', '*', 'CANNOT', 0 >+ '*', '*', 'CANNOT', 0 >+); >+$dbh->do( >+ q{INSERT INTO issuingrules (categorycode, branchcode, itemtype, reservesallowed) >+ VALUES (?, ?, ?, ?)}, >+ {}, >+ '*', '*', 'ONLY1', 1 > ); > > # make sure some basic sysprefs are set >-t::lib::Mocks::mock_preference('ReservesControlBranch', 'homebranch'); >+t::lib::Mocks::mock_preference('ReservesControlBranch', 'ItemHomeLibrary'); > t::lib::Mocks::mock_preference('item-level_itypes', 1); > > # if IndependentBranches is OFF, a CPL patron can reserve an MPL item >@@ -365,6 +372,27 @@ CancelExpiredReserves(); > $count = $dbh->selectrow_array("SELECT COUNT(*) FROM reserves WHERE reserve_id = ?", undef, $reserve_id ); > is( $count, 0, "Reserve with manual expiration date canceled correctly" ); > >+# Bug 12632 >+t::lib::Mocks::mock_preference( 'item-level_itypes', 1 ); >+t::lib::Mocks::mock_preference( 'ReservesControlBranch', 'PatronLibrary' ); >+ >+$dbh->do('DELETE FROM reserves'); >+$dbh->do('DELETE FROM issues'); >+$dbh->do('DELETE FROM items'); >+$dbh->do('DELETE FROM biblio'); >+ >+( $bibnum, $title, $bibitemnum ) = create_helper_biblio('ONLY1'); >+( $item_bibnum, $item_bibitemnum, $itemnumber ) = AddItem( { homebranch => 'CPL', holdingbranch => 'CPL' }, $bibnum ); >+ >+is( CanItemBeReserved( $borrowernumbers[0], $itemnumber ), >+ 'OK', 'Patron can reserve item with hold limit of 1, no holds placed' ); >+ >+my $res_id = AddReserve( $branch, $borrowernumbers[0], $bibnum, 'a', '', 1, ); >+ >+is( CanItemBeReserved( $borrowernumbers[0], $itemnumber ), >+ 'tooManyReserves', 'Patron cannot reserve item with hold limit of 1, 1 bib level hold placed' ); >+ >+ > # Helper method to set up a Biblio. > sub create_helper_biblio { > my $itemtype = shift; >-- >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 12632
:
31106
|
31107
|
32788
|
35255
|
35256
|
35257
|
41798
|
41799
|
41858
|
41934
|
41935
|
41950