Bugzilla – Attachment 128901 Details for
Bug 29102
DecreaseLoanHighHolds will decrease loan period if patron has an 'unfound' hold
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 29102: Unit tests
Bug-29102-Unit-tests.patch (text/plain), 3.12 KB, created by
Nick Clemens (kidclamp)
on 2021-12-23 17:18:33 UTC
(
hide
)
Description:
Bug 29102: Unit tests
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2021-12-23 17:18:33 UTC
Size:
3.12 KB
patch
obsolete
>From e0937a16bdacbb2dced192ed715f114fbe776e4f Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Thu, 23 Dec 2021 16:49:34 +0000 >Subject: [PATCH] Bug 29102: Unit tests > >--- > t/db_dependent/DecreaseLoanHighHolds.t | 56 +++++++++++++++++++++++++- > 1 file changed, 55 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/DecreaseLoanHighHolds.t b/t/db_dependent/DecreaseLoanHighHolds.t >index 8722a5c907..e981e32aee 100755 >--- a/t/db_dependent/DecreaseLoanHighHolds.t >+++ b/t/db_dependent/DecreaseLoanHighHolds.t >@@ -30,7 +30,7 @@ use Koha::CirculationRules; > use t::lib::TestBuilder; > use t::lib::Mocks; > >-use Test::More tests => 21; >+use Test::More tests => 22; > > my $dbh = C4::Context->dbh; > my $schema = Koha::Database->new()->schema(); >@@ -246,4 +246,58 @@ Koha::CirculationRules->set_rule( > $data = C4::Circulation::checkHighHolds( $item_hr, $patron_hr ); > is( $data->{duration}, 2, "Circulation rules override system preferences" ); > >+ >+subtest "Test patron's own holds do not count towards HighHolds count" => sub { >+ >+ plan tests => 2; >+ >+ my $item = $builder->build_sample_item(); >+ my $item2 = $builder->build_sample_item({ biblionumber => $item->biblionumber }); >+ my $item3 = $builder->build_sample_item({ biblionumber => $item->biblionumber }); >+ >+ my $patron = $builder->build_object({ >+ class => 'Koha::Patrons', >+ value => { >+ branchcode => $item->homebranch >+ } >+ }); >+ my $hold = $builder->build_object({ >+ class => 'Koha::Holds', >+ value => { >+ biblionumber => $item->biblionumber, >+ borrowernumber => $patron->id, >+ suspend => 0, >+ found => undef >+ } >+ }); >+ >+ Koha::CirculationRules->set_rules( >+ { >+ branchcode => $item->homebranch, >+ categorycode => undef, >+ itemtype => $item->itype, >+ rules => { >+ issuelength => '14', >+ lengthunit => 'days', >+ reservesallowed => '99', >+ holds_per_record => '1', >+ } >+ } >+ ); >+ >+ t::lib::Mocks::mock_preference( 'decreaseLoanHighHolds', 1 ); >+ t::lib::Mocks::mock_preference( 'decreaseLoanHighHoldsDuration', 1 ); >+ 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 $data = C4::Circulation::checkHighHolds( $item->unblessed , $patron->unblessed ); >+ ok( !$data->{exceeded}, "Patron's hold on the record does not limit their own circulation if static decrease"); >+ t::lib::Mocks::mock_preference( 'decreaseLoanHighHoldsControl', 'dynamic' ); >+ # 3 items on record, patron has 1 hold >+ $data = C4::Circulation::checkHighHolds( $item->unblessed , $patron->unblessed ); >+ ok( !$data->{exceeded}, "Patron's hold on the record does not limit their own circulation if dynamic decrease"); >+ >+}; >+ > $schema->storage->txn_rollback(); >-- >2.30.2
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 29102
:
128901
|
128902
|
128903
|
137722
|
137723
|
137745
|
137746
|
140970
|
140971
|
142990
|
142991