Bugzilla – Attachment 121542 Details for
Bug 28503
When ReservesControlBranch = "patron's home library" and Hold policy = "From home library" all holds are allowed
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 28503: Unit tests
Bug-28503-Unit-tests.patch (text/plain), 4.31 KB, created by
Nick Clemens (kidclamp)
on 2021-06-02 15:28:58 UTC
(
hide
)
Description:
Bug 28503: Unit tests
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2021-06-02 15:28:58 UTC
Size:
4.31 KB
patch
obsolete
>From f8013f6cf49af601154729e631bb6c5d37716134 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Wed, 2 Jun 2021 15:05:08 +0000 >Subject: [PATCH] Bug 28503: Unit tests > >--- > misc/cronjobs/update_patrons_category.pl | 1 + > t/db_dependent/Reserves.t | 66 +++++++++++++++++++++++++++++++- > 2 files changed, 65 insertions(+), 2 deletions(-) > >diff --git a/misc/cronjobs/update_patrons_category.pl b/misc/cronjobs/update_patrons_category.pl >index 86541a818d..fd4bc4a7ea 100755 >--- a/misc/cronjobs/update_patrons_category.pl >+++ b/misc/cronjobs/update_patrons_category.pl >@@ -47,6 +47,7 @@ update_patrons_category.pl -f=categorycode -t=categorycode > update_patrons_category.pl --help | --man > > Options: >+ > --help brief help message > --man full documentation > -too_old update if over maximum age for current category >diff --git a/t/db_dependent/Reserves.t b/t/db_dependent/Reserves.t >index 5d661ee97f..cd55a13266 100755 >--- a/t/db_dependent/Reserves.t >+++ b/t/db_dependent/Reserves.t >@@ -1077,9 +1077,9 @@ subtest 'RevertWaitingStatus' => sub { > ); > }; > >-subtest 'CheckReserves additional test' => sub { >+subtest 'CheckReserves additional tests' => sub { > >- plan tests => 3; >+ plan tests => 8; > > my $item = $builder->build_sample_item; > my $reserve1 = $builder->build_object( >@@ -1152,6 +1152,68 @@ subtest 'CheckReserves additional test' => sub { > is( $matched_reserve->{reserve_id}, > $reserve1->reserve_id, "We got the Transit reserve" ); > is( scalar @$possible_reserves, 2, 'We do get both reserves' ); >+ >+ my $patron_B = $builder->build_object({ class => "Koha::Patrons" }); >+ my $item_A = $builder->build_sample_item; >+ my $item_B = $builder->build_sample_item({ >+ homebranch => $patron_B->branchcode, >+ biblionumber => $item_A->biblionumber, >+ itype => $item_A->itype >+ }); >+ Koha::CirculationRules->set_rules( >+ { >+ branchcode => undef, >+ categorycode => undef, >+ itemtype => $item_A->itype, >+ rules => { >+ reservesallowed => 25, >+ holds_per_record => 1, >+ } >+ } >+ ); >+ Koha::CirculationRules->set_rule({ >+ branchcode => undef, >+ itemtype => $item_A->itype, >+ rule_name => 'holdallowed', >+ rule_value => 'from_home_library' >+ }); >+ my $reserve_id = AddReserve( >+ { >+ branchcode => $patron_B->branchcode, >+ borrowernumber => $patron_B->borrowernumber, >+ biblionumber => $item_A->biblionumber, >+ priority => 1, >+ itemnumber => undef, >+ } >+ ); >+ >+ ok( $reserve_id, "We can place a record level hold because one item is owned by patron's home library"); >+ t::lib::Mocks::mock_preference('ReservesControlBranch', 'ItemHomeLibrary'); >+ ( $status, $matched_reserve, $possible_reserves ) = CheckReserves( $item_A->itemnumber ); >+ is( $status, "", "We do not fill the hold with item A because it is not from the patron's homebranch"); >+ Koha::CirculationRules->set_rule({ >+ branchcode => $item_A->homebranch, >+ itemtype => $item_A->itype, >+ rule_name => 'holdallowed', >+ rule_value => 'from_any_library' >+ }); >+ ( $status, $matched_reserve, $possible_reserves ) = CheckReserves( $item_A->itemnumber ); >+ is( $status, "Reserved", "We fill the hold with item A because item's branch rule says allow any"); >+ >+ >+ # Changing the control branch should change only the rule we get >+ t::lib::Mocks::mock_preference('ReservesControlBranch', 'PatronLibrary'); >+ ( $status, $matched_reserve, $possible_reserves ) = CheckReserves( $item_A->itemnumber ); >+ is( $status, "", "We do not fill the hold with item A because it is not from the patron's homebranch"); >+ Koha::CirculationRules->set_rule({ >+ branchcode => $patron_B->branchcode, >+ itemtype => $item_A->itype, >+ rule_name => 'holdallowed', >+ rule_value => 'from_any_library' >+ }); >+ ( $status, $matched_reserve, $possible_reserves ) = CheckReserves( $item_A->itemnumber ); >+ is( $status, "Reserved", "We fill the hold with item A because patron's branch rule says allow any"); >+ > }; > > subtest 'AllowHoldOnPatronPossession test' => sub { >-- >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 28503
:
121542
|
121543
|
121544
|
121614
|
121615
|
121616
|
121991
|
121992
|
121993
|
121994
|
122282