Bugzilla – Attachment 129928 Details for
Bug 29562
Pass objects to CanItemBeReserved and checkHighHolds
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 29562: Fix DecreaseLoanHighHolds.t
Bug-29562-Fix-DecreaseLoanHighHoldst.patch (text/plain), 5.91 KB, created by
Jonathan Druart
on 2022-01-28 12:21:37 UTC
(
hide
)
Description:
Bug 29562: Fix DecreaseLoanHighHolds.t
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2022-01-28 12:21:37 UTC
Size:
5.91 KB
patch
obsolete
>From 3de78cc5047c13d8c939a37b8f8952f29487ea2e Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Mon, 10 Jan 2022 13:39:35 +0100 >Subject: [PATCH] Bug 29562: Fix DecreaseLoanHighHolds.t > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> > >Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >--- > t/db_dependent/DecreaseLoanHighHolds.t | 30 +++++++++++--------------- > 1 file changed, 13 insertions(+), 17 deletions(-) > >diff --git a/t/db_dependent/DecreaseLoanHighHolds.t b/t/db_dependent/DecreaseLoanHighHolds.t >index 8722a5c907f..e4df3def211 100755 >--- a/t/db_dependent/DecreaseLoanHighHolds.t >+++ b/t/db_dependent/DecreaseLoanHighHolds.t >@@ -127,10 +127,7 @@ t::lib::Mocks::mock_preference( 'decreaseLoanHighHoldsValue', 1 ); > t::lib::Mocks::mock_preference( 'decreaseLoanHighHoldsControl', 'static' ); > t::lib::Mocks::mock_preference( 'decreaseLoanHighHoldsIgnoreStatuses', 'damaged,itemlost,notforloan,withdrawn' ); > >-my $item_hr = { itemnumber => $item->id, biblionumber => $biblio->id, homebranch => $library->{branchcode}, holdingbranch => $library->{branchcode}, barcode => $item->barcode }; >-my $patron_hr = { borrowernumber => $patron->id, branchcode => $library->{branchcode} }; >- >-my $data = C4::Circulation::checkHighHolds( $item_hr, $patron_hr ); >+my $data = C4::Circulation::checkHighHolds( $item, $patron ); > is( $data->{exceeded}, 1, "Static mode should exceed threshold" ); > is( $data->{outstanding}, 6, "Should have 6 outstanding holds" ); > is( $data->{duration}, 0, "Should have duration of 0 because of specific circulation rules" ); >@@ -151,7 +148,7 @@ Koha::CirculationRules->set_rules( > } > ); > >-$data = C4::Circulation::checkHighHolds( $item_hr, $patron_hr ); >+$data = C4::Circulation::checkHighHolds( $item, $patron ); > is( $data->{duration}, 1, "Should have a duration of 1 because no specific circulation rules so defaults to system preference" ); > > my $duedate = $data->{due_date}; >@@ -160,7 +157,7 @@ is($duedate->min, $orig_due->min, 'New due minute is equal to original due minut > is($duedate->sec, 0, 'New due date second is zero.'); > > t::lib::Mocks::mock_preference( 'decreaseLoanHighHoldsControl', 'dynamic' ); >-$data = C4::Circulation::checkHighHolds( $item_hr, $patron_hr ); >+$data = C4::Circulation::checkHighHolds( $item, $patron ); > is( $data->{exceeded}, 0, "Should not exceed threshold" ); > > >@@ -177,13 +174,13 @@ for my $i ( 5 .. 10 ) { > } > > # 12 holds, threshold is 1 over 10 holdable items = 11 >-$data = C4::Circulation::checkHighHolds( $item_hr, $patron_hr ); >+$data = C4::Circulation::checkHighHolds( $item, $patron ); > is( $data->{exceeded}, 1, "Should exceed threshold of 1" ); > is( $data->{outstanding}, 12, "Should exceed threshold of 1" ); > > # 12 holds, threshold is 2 over 10 holdable items = 12 (equal is okay) > t::lib::Mocks::mock_preference( 'decreaseLoanHighHoldsValue', 2 ); >-$data = C4::Circulation::checkHighHolds( $item_hr, $patron_hr ); >+$data = C4::Circulation::checkHighHolds( $item, $patron ); > is( $data->{exceeded}, 0, "Should not exceed threshold of 2" ); > > my $unholdable = pop(@items); >@@ -191,7 +188,7 @@ $unholdable->damaged(-1); > $unholdable->store(); > > # 12 holds, threshold is 2 over 9 holdable items = 11 >-$data = C4::Circulation::checkHighHolds( $item_hr, $patron_hr ); >+$data = C4::Circulation::checkHighHolds( $item, $patron ); > is( $data->{exceeded}, 1, "Should exceed threshold with one damaged item" ); > > $unholdable->damaged(0); >@@ -199,7 +196,7 @@ $unholdable->itemlost(-1); > $unholdable->store(); > > # 12 holds, threshold is 2 over 9 holdable items = 11 >-$data = C4::Circulation::checkHighHolds( $item_hr, $patron_hr ); >+$data = C4::Circulation::checkHighHolds( $item, $patron ); > is( $data->{exceeded}, 1, "Should exceed threshold with one lost item" ); > > $unholdable->itemlost(0); >@@ -207,7 +204,7 @@ $unholdable->notforloan(-1); > $unholdable->store(); > > # 12 holds, threshold is 2 over 9 holdable items = 11 >-$data = C4::Circulation::checkHighHolds( $item_hr, $patron_hr ); >+$data = C4::Circulation::checkHighHolds( $item, $patron ); > is( $data->{exceeded}, 1, "Should exceed threshold with one notforloan item" ); > > $unholdable->notforloan(0); >@@ -215,22 +212,21 @@ $unholdable->withdrawn(-1); > $unholdable->store(); > > # 12 holds, threshold is 2 over 9 holdable items = 11 >-$data = C4::Circulation::checkHighHolds( $item_hr, $patron_hr ); >+$data = C4::Circulation::checkHighHolds( $item, $patron ); > is( $data->{exceeded}, 1, "Should exceed threshold with one withdrawn item" ); > > $patron_hold->found('F')->store; > # 11 holds, threshold is 2 over 9 holdable items = 11 >-$data = C4::Circulation::checkHighHolds( $item_hr, $patron_hr ); >+$data = C4::Circulation::checkHighHolds( $item, $patron ); > is( $data->{exceeded}, 1, "Should exceed threshold with one withdrawn item" ); > $patron_hold->found(undef)->store; > > t::lib::Mocks::mock_preference('CircControl', 'PatronLibrary'); > >-my $patron_object = Koha::Patrons->find( $patron_hr->{borrowernumber} ); >-my ( undef, $needsconfirmation ) = CanBookBeIssued( $patron_object, $item->barcode ); >+my ( undef, $needsconfirmation ) = CanBookBeIssued( $patron, $item->barcode ); > ok( $needsconfirmation->{HIGHHOLDS}, "High holds checkout needs confirmation" ); > >-( undef, $needsconfirmation ) = CanBookBeIssued( $patron_object, $item->barcode, undef, undef, undef, { override_high_holds => 1 } ); >+( undef, $needsconfirmation ) = CanBookBeIssued( $patron, $item->barcode, undef, undef, undef, { override_high_holds => 1 } ); > ok( !$needsconfirmation->{HIGHHOLDS}, "High holds checkout does not need confirmation" ); > > Koha::CirculationRules->set_rule( >@@ -243,7 +239,7 @@ Koha::CirculationRules->set_rule( > } > ); > >-$data = C4::Circulation::checkHighHolds( $item_hr, $patron_hr ); >+$data = C4::Circulation::checkHighHolds( $item, $patron ); > is( $data->{duration}, 2, "Circulation rules override system preferences" ); > > $schema->storage->txn_rollback(); >-- >2.25.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 29562
:
127966
|
129245
|
129246
|
129252
|
129253
|
129254
|
129255
|
129257
|
129261
|
129262
|
129263
|
129264
|
129926
|
129927
| 129928 |
129929
|
130033