Bugzilla – Attachment 121100 Details for
Bug 20985
CanBookBeReserved and CanItemBeReserved should check 'On shelf holds allowed' policy
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 20985: Unit tests
Bug-20985-Unit-tests.patch (text/plain), 3.67 KB, created by
Arthur Suzuki
on 2021-05-18 09:33:53 UTC
(
hide
)
Description:
Bug 20985: Unit tests
Filename:
MIME Type:
Creator:
Arthur Suzuki
Created:
2021-05-18 09:33:53 UTC
Size:
3.67 KB
patch
obsolete
>From cb1f7a657cc86667c17a198ce5a0f31e3b068006 Mon Sep 17 00:00:00 2001 >From: Arthur Suzuki <arthur.suzuki@biblibre.com> >Date: Thu, 21 Mar 2019 21:52:06 +0100 >Subject: [PATCH] Bug 20985: Unit tests > >Signed-off-by: David Nind <david@davidnind.com> >--- > t/db_dependent/Reserves.t | 81 +++++++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 81 insertions(+) > >diff --git a/t/db_dependent/Reserves.t b/t/db_dependent/Reserves.t >index 5d661ee97f..6e65f03f47 100755 >--- a/t/db_dependent/Reserves.t >+++ b/t/db_dependent/Reserves.t >@@ -188,6 +188,7 @@ Koha::CirculationRules->set_rules( > rules => { > reservesallowed => 25, > holds_per_record => 1, >+ onshelfholds => 1, > } > } > ); >@@ -987,7 +988,76 @@ subtest 'reserves.item_level_hold' => sub { > > $hold->delete; > }; >+}; >+ >+subtest 'OnShelfHoldAllowed test' => sub { >+ plan tests => 3; >+ $dbh->do('DELETE FROM circulation_rules'); >+ my $biblio = $builder->build_sample_biblio({frameworkcode => $frameworkcode})->biblionumber; >+ >+ # Create a helper item instance for testing >+ my $item = $builder->build_sample_item({ biblionumber => $biblio, library => $branch_1, itype => $itemtype }); >+ >+ Koha::CirculationRules->set_rules( >+ { >+ branchcode => undef, >+ categorycode => undef, >+ itemtype => undef, >+ rules => { >+ reservesallowed => 25, >+ opacitemholds => 'Y', >+ onshelfholds => 1, >+ } >+ } >+ ); >+ >+ my $canreserve = C4::Reserves::CanItemBeReserved( >+ $patron->borrowernumber, >+ $item->itemnumber, >+ ); >+ >+ is( $canreserve->{status}, 'OK', >+ 'item-level holds should be possible with onshelfholdallowed set to "Yes"' ); >+ >+ Koha::CirculationRules->set_rules( >+ { >+ branchcode => undef, >+ categorycode => undef, >+ itemtype => undef, >+ rules => { >+ reservesallowed => 25, >+ opacitemholds => 'Y', >+ onshelfholds => '0', >+ } >+ }); >+ >+ $canreserve = C4::Reserves::CanItemBeReserved( >+ $patron->borrowernumber, >+ $item->itemnumber, >+ ); >+ >+ is( $canreserve->{status}, 'onShelfHoldsNotAllowed', >+ 'item-level holds should not be possible with onshelfholdallowed set to "If any unavailable"' ); >+ >+ Koha::CirculationRules->set_rules( >+ { >+ branchcode => undef, >+ categorycode => undef, >+ itemtype => undef, >+ rules => { >+ reservesallowed => 25, >+ opacitemholds => 'Y', >+ onshelfholds => '2', >+ } >+ }); > >+ $canreserve = C4::Reserves::CanItemBeReserved( >+ $patron->borrowernumber, >+ $item->itemnumber, >+ ); >+ >+ is( $canreserve->{status}, 'onShelfHoldsNotAllowed', >+ 'item-level holds should not be possible with onshelfholdallowed set to "If all unavailable"' ); > }; > > subtest 'MoveReserve additional test' => sub { >@@ -1165,6 +1235,17 @@ subtest 'AllowHoldOnPatronPossession test' => sub { > my $patron = $builder->build_object({ class => "Koha::Patrons", > value => { branchcode => $item->homebranch }}); > >+ Koha::CirculationRules->set_rules( >+ { >+ branchcode => undef, >+ categorycode => undef, >+ itemtype => undef, >+ rules => { >+ onshelfholds => 1, >+ } >+ } >+ ); >+ > C4::Circulation::AddIssue($patron->unblessed, > $item->barcode); > t::lib::Mocks::mock_preference('AllowHoldsOnPatronsPossessions', 0); >-- >2.11.0
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 20985
:
86874
|
89723
|
105991
|
110095
|
111954
|
112688
|
113730
|
113731
|
114801
|
114802
|
114804
|
114805
|
115732
|
115733
|
121100
|
121101
|
121102
|
121139
|
121176
|
121185
|
121186
|
121485
|
121486
|
154711