Bugzilla – Attachment 185585 Details for
Bug 11999
Add two checks in CanBookBeReserved and CanItemBeReserved
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 11999: add test for maxreserves in Reserves.t
Bug-11999-add-test-for-maxreserves-in-Reservest.patch (text/plain), 2.50 KB, created by
Arthur Suzuki
on 2025-08-20 13:36:17 UTC
(
hide
)
Description:
Bug 11999: add test for maxreserves in Reserves.t
Filename:
MIME Type:
Creator:
Arthur Suzuki
Created:
2025-08-20 13:36:17 UTC
Size:
2.50 KB
patch
obsolete
>From f97f6692226dcfe7699be2d4f7a6b8de3f257eb5 Mon Sep 17 00:00:00 2001 >From: Arthur Suzuki <arthur.suzuki@biblibre.com> >Date: Thu, 18 Jul 2019 15:03:40 +0200 >Subject: [PATCH] Bug 11999: add test for maxreserves in Reserves.t > >--- > t/db_dependent/Reserves.t | 37 ++++++++++++++++++++++++++++++++++++- > 1 file changed, 36 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Reserves.t b/t/db_dependent/Reserves.t >index b7b1d26dc41..1a8abb3c1c0 100755 >--- a/t/db_dependent/Reserves.t >+++ b/t/db_dependent/Reserves.t >@@ -17,7 +17,7 @@ > > use Modern::Perl; > >-use Test::More tests => 70; >+use Test::More tests => 71; > use Test::NoWarnings; > use Test::MockModule; > use Test::Warn; >@@ -1351,6 +1351,41 @@ subtest 'AllowHoldOnPatronPossession test' => sub { > ); > }; > >+subtest 'check maxreserve test' => sub { >+ >+ plan tests => 2; >+ >+ $schema->storage->txn_begin; >+ t::lib::Mocks::mock_preference('maxreserves', 1); >+ # Create the items and patrons we need >+ my $biblio_1 = $builder->build_sample_biblio(); >+ my $biblio_2 = $builder->build_sample_biblio(); >+ my $itype = $builder->build_object({ class => "Koha::ItemTypes", value => { notforloan => 0 } }); >+ my $item_1 = $builder->build_sample_item({ biblionumber => $biblio_1->biblionumber,notforloan => 0, itype => $itype->itemtype }); >+ my $item_2 = $builder->build_sample_item({ biblionumber => $biblio_2->biblionumber, notforloan => 0, itype => $itype->itemtype }); >+ my $patron = $builder->build_object({ class => "Koha::Patrons", >+ value => { branchcode => $item_2->homebranch }}); >+ >+ >+ # Place a hold on the title for both patrons >+ my $reserve = AddReserve( >+ { >+ branchcode => $item_1->homebranch, >+ borrowernumber => $patron->borrowernumber, >+ biblionumber => $biblio_1->biblionumber, >+ priority => 1, >+ itemnumber => $item_1->itemnumber, >+ } >+ ); >+ >+ my $borrowernumber = $patron->borrowernumber; >+ >+ is( C4::Reserves::CanBookBeReserved($borrowernumber, $biblio_2->biblionumber)->{status} , 'tooManyReserves', "CanBookBeReserved: Reserving more than maxreserves is forbidden"); >+ is( C4::Reserves::CanItemBeReserved($patron, $item_2, $item_2->homebranch)->{status} , 'tooManyReserves', "CanItemBeReserved: Reserving more than maxreserves is forbidden"); >+ t::lib::Mocks::mock_preference('maxreserves', 20); >+ $schema->storage->txn_rollback; >+}; >+ > subtest 'MergeHolds' => sub { > > plan tests => 1; >-- >2.39.5
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 11999
:
26589
|
28986
|
31524
|
35697
|
36358
|
36404
|
36630
|
38397
|
41951
|
41952
|
44631
|
44632
|
46262
|
46263
|
50224
|
50225
|
58741
|
58742
|
58743
|
63593
|
63594
|
63595
|
66267
|
66268
|
66269
|
66270
|
88300
|
88301
|
88302
|
88303
|
90142
|
90143
|
90144
|
90146
|
90147
|
91046
|
91402
|
91403
|
91479
|
91481
|
91494
|
91580
|
91581
|
91582
|
91590
|
91591
|
91592
|
91593
|
99927
|
99928
|
106481
|
106494
|
111687
|
111688
|
111689
|
112871
|
112872
|
112873
|
112874
|
120776
|
120777
|
120778
|
120779
|
120780
|
121531
|
121612
|
185584
|
185585
|
185586