Bugzilla – Attachment 128859 Details for
Bug 29750
Reserves.pm should check patron category hold policies when finding a reserve for an item
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 29750: Unit test fixes for Reserves.pm
Bug-29750-Unit-test-fixes-for-Reservespm.patch (text/plain), 5.56 KB, created by
Alex Buckley
on 2021-12-22 04:25:51 UTC
(
hide
)
Description:
Bug 29750: Unit test fixes for Reserves.pm
Filename:
MIME Type:
Creator:
Alex Buckley
Created:
2021-12-22 04:25:51 UTC
Size:
5.56 KB
patch
obsolete
>From 4665c0547d53208df8745f5039cc1be8ffcfa7b0 Mon Sep 17 00:00:00 2001 >From: Alex Buckley <alexbuckley@catalyst.net.nz> >Date: Thu, 9 Dec 2021 19:46:21 +0000 >Subject: [PATCH] Bug 29750: Unit test fixes for Reserves.pm > >Test plan: >1. sudo koha-shell <instance> >2. >prove t/db_dependent/Holds.t >prove t/db_dependent/Reserves.t > >Sponsored-By: Brimbank Library, Australia >--- > t/db_dependent/Holds.t | 6 +++--- > t/db_dependent/Reserves.t | 41 ++++++++++++++++++++++++++++++++++------- > 2 files changed, 37 insertions(+), 10 deletions(-) > >diff --git a/t/db_dependent/Holds.t b/t/db_dependent/Holds.t >index 69e9b2bc10..b1bf92c3c1 100755 >--- a/t/db_dependent/Holds.t >+++ b/t/db_dependent/Holds.t >@@ -40,7 +40,7 @@ my $builder = t::lib::TestBuilder->new(); > my $dbh = C4::Context->dbh; > > # Create two random branches >-my $branch_1 = $builder->build({ source => 'Branch' })->{ branchcode }; >+my $branch_1 = $builder->build({ source => 'Branch', value => { 'pickup_location' => 1 }})->{ branchcode }; > my $branch_2 = $builder->build({ source => 'Branch' })->{ branchcode }; > > my $category = $builder->build({ source => 'Category' }); >@@ -1466,8 +1466,8 @@ subtest 'non priority holds' => sub { > } > ); > >- my $item = $builder->build_sample_item; >- >+ my $branch = $builder->build_object( { class => 'Koha::Libraries', value => { pickup_location => 1 } } ); >+ my $item = $builder->build_sample_item({ library => $branch->branchcode }); > my $patron1 = $builder->build_object( > { > class => 'Koha::Patrons', >diff --git a/t/db_dependent/Reserves.t b/t/db_dependent/Reserves.t >index 9b4122dbd4..099971bd99 100755 >--- a/t/db_dependent/Reserves.t >+++ b/t/db_dependent/Reserves.t >@@ -71,9 +71,9 @@ $cache->clear_from_cache("MarcSubfieldStructure-$frameworkcode"); > > ## Setup Test > # Add branches >-my $branch_1 = $builder->build({ source => 'Branch' })->{ branchcode }; >-my $branch_2 = $builder->build({ source => 'Branch' })->{ branchcode }; >-my $branch_3 = $builder->build({ source => 'Branch' })->{ branchcode }; >+my $branch_1 = $builder->build({ source => 'Branch', value => { pickup_location => 1 } })->{ branchcode }; >+my $branch_2 = $builder->build({ source => 'Branch', value => { pickup_location => 1 } })->{ branchcode }; >+my $branch_3 = $builder->build({ source => 'Branch', value => { pickup_location => 1 } })->{ branchcode }; > # Add categories > my $category_1 = $builder->build({ source => 'Category' })->{ categorycode }; > my $category_2 = $builder->build({ source => 'Category' })->{ categorycode }; >@@ -108,6 +108,19 @@ my $borrower = $patron->unblessed; > my $biblionumber = $bibnum; > my $barcode = $testbarcode; > >+# Set circulation rules >+Koha::CirculationRules->set_rules( >+ { >+ categorycode => undef, >+ branchcode => undef, >+ itemtype => undef, >+ rules => { >+ reservesallowed => 25, >+ holds_per_record => 99, >+ } >+ } >+); >+ > my $branchcode = Koha::Libraries->search->next->branchcode; > > AddReserve( >@@ -215,6 +228,17 @@ Koha::CirculationRules->set_rules( > } > } > ); >+Koha::CirculationRules->set_rules( >+ { >+ categorycode => undef, >+ branchcode => undef, >+ itemtype => undef, >+ rules => { >+ reservesallowed => 25, >+ holds_per_record => 99, >+ } >+ } >+); > > my $bibnum2 = $builder->build_sample_biblio({frameworkcode => $frameworkcode})->biblionumber; > >@@ -999,9 +1023,10 @@ subtest 'MoveReserve additional test' => sub { > > # Create the items and patrons we need > my $biblio = $builder->build_sample_biblio(); >+ my $branch = $builder->build({ source => 'Branch', value => { pickup_location => 1 } })->{ branchcode }; > my $itype = $builder->build_object({ class => "Koha::ItemTypes", value => { notforloan => 0 } }); >- my $item_1 = $builder->build_sample_item({ biblionumber => $biblio->biblionumber,notforloan => 0, itype => $itype->itemtype }); >- my $item_2 = $builder->build_sample_item({ biblionumber => $biblio->biblionumber, notforloan => 0, itype => $itype->itemtype }); >+ my $item_1 = $builder->build_sample_item({ biblionumber => $biblio->biblionumber,notforloan => 0, itype => $itype->itemtype, library => $branch }); >+ my $item_2 = $builder->build_sample_item({ biblionumber => $biblio->biblionumber, notforloan => 0, itype => $itype->itemtype, library => $branch }); > my $patron_1 = $builder->build_object({ class => "Koha::Patrons" }); > my $patron_2 = $builder->build_object({ class => "Koha::Patrons" }); > >@@ -1083,8 +1108,10 @@ subtest 'RevertWaitingStatus' => sub { > subtest 'CheckReserves additional tests' => sub { > > plan tests => 8; >+ my $branch_1 = $builder->build({ source => 'Branch', value => { pickup_location => 1 } })->{ branchcode }; >+ my $branch_2 = $builder->build({ source => 'Branch', value => { pickup_location => 1 } })->{ branchcode }; > >- my $item = $builder->build_sample_item; >+ my $item = $builder->build_sample_item({ library => $branch_1 }); > my $reserve1 = $builder->build_object( > { > class => "Koha::Holds", >@@ -1156,7 +1183,7 @@ subtest 'CheckReserves additional tests' => sub { > $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 $patron_B = $builder->build_object({ class => "Koha::Patrons", value => { branchcode => $branch_2, } }); > my $item_A = $builder->build_sample_item; > my $item_B = $builder->build_sample_item({ > homebranch => $patron_B->branchcode, >-- >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 29750
:
128858
|
128859
|
154140
|
154141
|
154159
|
154160