Bugzilla – Attachment 40174 Details for
Bug 14155
Placing holds via ILSDI bypass some checks
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 14155 - Add tests in t/db_dependent/Reserves.t
Bug-14155---Add-tests-in-tdbdependentReservest.patch (text/plain), 3.79 KB, created by
Indranil Das Gupta
on 2015-06-16 10:48:20 UTC
(
hide
)
Description:
Bug 14155 - Add tests in t/db_dependent/Reserves.t
Filename:
MIME Type:
Creator:
Indranil Das Gupta
Created:
2015-06-16 10:48:20 UTC
Size:
3.79 KB
patch
obsolete
>From c390c0c1a3dd6319a6e832f7df6e2f1c9b4a6e2c Mon Sep 17 00:00:00 2001 >From: Alex Arnaud <alex.arnaud@biblibre.com> >Date: Tue, 16 Jun 2015 11:48:08 +0200 >Subject: [PATCH] Bug 14155 - Add tests in t/db_dependent/Reserves.t > >- add tests for C4::Reserves::AlreadyReserved(), >- add tests for C4::Reserves::ReachedMaxReserves(), > >Signed-off-by: Indranil Das Gupta (L2C2 Technologies) <indradg@gmail.com> >--- > t/db_dependent/Reserves.t | 54 ++++++++++++++++++++++++++++++++++++++++++++++- > 1 file changed, 53 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Reserves.t b/t/db_dependent/Reserves.t >index fa0cf94..94be823 100755 >--- a/t/db_dependent/Reserves.t >+++ b/t/db_dependent/Reserves.t >@@ -17,7 +17,7 @@ > > use Modern::Perl; > >-use Test::More tests => 56; >+use Test::More tests => 60; > > use MARC::Record; > use DateTime::Duration; >@@ -80,6 +80,38 @@ else { > my ($bibnum, $bibitemnum); > ($bibnum, $title, $bibitemnum) = AddBiblio($bib, ''); > >+my $miniaturist = MARC::Record->new(); >+my $title = 'The Miniaturist'; >+if( C4::Context->preference('marcflavour') eq 'UNIMARC' ) { >+ $miniaturist->append_fields( >+ MARC::Field->new('600', '', '1', a => 'Burton, Jessie'), >+ MARC::Field->new('200', '', '', a => $title), >+ ); >+} >+else { >+ $miniaturist->append_fields( >+ MARC::Field->new('100', '', '', a => 'Burton, Jessie'), >+ MARC::Field->new('245', '', '', a => $title), >+ ); >+} >+my ($miniaturist_id, $title, $bibitemnum) = AddBiblio($miniaturist, ''); >+ >+my $broken = MARC::Record->new(); >+my $title = 'The broken'; >+if( C4::Context->preference('marcflavour') eq 'UNIMARC' ) { >+ $broken->append_fields( >+ MARC::Field->new('600', '', '1', a => 'Cohen, Tamar'), >+ MARC::Field->new('200', '', '', a => $title), >+ ); >+} >+else { >+ $broken->append_fields( >+ MARC::Field->new('100', '', '', a => 'Cohen, Tamar'), >+ MARC::Field->new('245', '', '', a => $title), >+ ); >+} >+my ($broken_id, $title, $bibitemnum) = AddBiblio($miniaturist, ''); >+ > # Create a helper item instance for testing > my ($item_bibnum, $item_bibitemnum, $itemnumber) = AddItem({ homebranch => 'CPL', holdingbranch => 'CPL' } , $bibnum); > >@@ -127,6 +159,24 @@ is($status, "Reserved", "CheckReserves Test 2"); > ($status, $reserve, $all_reserves) = CheckReserves(undef, $barcode); > is($status, "Reserved", "CheckReserves Test 3"); > >+ok(AlreadyReserved($biblionumber, $borrowernumber), 'First borrower already reserved first biblio'); >+ >+t::lib::Mocks::mock_preference('maxreserves', 3); >+ >+ok(!ReachedMaxReserves($borrowernumber), 'First borrower doesn\'t reached max reserves'); >+ >+AddReserve($branch, $borrowernumber, $miniaturist_id, >+ $constraint, $bibitems, $priority, $resdate, $expdate, $notes, >+ $title, $checkitem, $found); >+ >+AddReserve($branch, $borrowernumber, $broken_id, >+ $constraint, $bibitems, $priority, $resdate, $expdate, $notes, >+ $title, $checkitem, $found); >+ >+ok(ReachedMaxReserves($borrowernumber), 'First borrower reached max reserves'); >+ >+t::lib::Mocks::mock_preference('maxreserves', 15); >+ > my $ReservesControlBranch = C4::Context->preference('ReservesControlBranch'); > C4::Context->set_preference( 'ReservesControlBranch', 'ItemHomeLibrary' ); > ok( >@@ -292,6 +342,8 @@ is($reserve, undef, "GetReserve returns undef after deletion"); > $reserve = CancelReserve({reserve_id => $reserve_id}); > is($reserve, undef, "CancelReserve return undef if reserve does not exist"); > >+ok(!AlreadyReserved($bibnum2, $borrowernumber), 'First borrower does not already reserved second biblio'); >+ > > # Tests for bug 9761 (ConfirmFutureHolds): new CheckReserves lookahead parameter, and corresponding change in AddReturn > # Note that CheckReserve uses its lookahead parameter and does not check ConfirmFutureHolds pref (it should be passed if needed like AddReturn does) >-- >1.9.1
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 14155
:
38884
|
40170
|
40174
|
40175
|
40176
|
40208
|
40210
|
40239
|
40240
|
40241
|
44047
|
44048
|
44049
|
44050
|
44064