Bugzilla – Attachment 144507 Details for
Bug 30860
Performance: Add option for CanBookBeReserved to return all item values
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 30860: Unit test
Bug-30860-Unit-test.patch (text/plain), 2.93 KB, created by
ByWater Sandboxes
on 2022-12-08 20:07:54 UTC
(
hide
)
Description:
Bug 30860: Unit test
Filename:
MIME Type:
Creator:
ByWater Sandboxes
Created:
2022-12-08 20:07:54 UTC
Size:
2.93 KB
patch
obsolete
>From 83a0f7644817b552f31c262d9659a8450b7c3880 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Fri, 27 May 2022 12:43:00 +0000 >Subject: [PATCH] Bug 30860: Unit test > >Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org> >--- > t/db_dependent/Reserves.t | 51 ++++++++++++++++++++++++++++++++++++++- > 1 file changed, 50 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Reserves.t b/t/db_dependent/Reserves.t >index 1f368e36b6..5f25ae49fc 100755 >--- a/t/db_dependent/Reserves.t >+++ b/t/db_dependent/Reserves.t >@@ -17,7 +17,7 @@ > > use Modern::Perl; > >-use Test::More tests => 77; >+use Test::More tests => 78; > use Test::MockModule; > use Test::Warn; > >@@ -1719,3 +1719,52 @@ subtest 'CanItemBeReserved() tests' => sub { > > $schema->storage->txn_rollback; > }; >+ >+subtest 'CanBookBeReserved return_all_items tests' => sub { >+ >+ plan tests => 3; >+ >+ $schema->storage->txn_begin; >+ >+ my $patron = $builder->build_object({ class => "Koha::Patrons" }); >+ >+ my $item_1 = $builder->build_sample_item({ homebranch => $patron->branchcode }); >+ my $item_2 = $builder->build_sample_item({ biblionumber => $item_1->biblionumber }); >+ my $item_3 = $builder->build_sample_item({ biblionumber => $item_1->biblionumber }); >+ my $item_4 = $builder->build_sample_item({ biblionumber => $item_1->biblionumber }); >+ >+ my $can_book_be = CanBookBeReserved($patron->borrowernumber,$item_1->biblionumber); >+ my $can_item_1_be = CanItemBeReserved($patron,$item_1); >+ my $can_item_2_be = CanItemBeReserved($patron,$item_2); >+ my $can_item_3_be = CanItemBeReserved($patron,$item_3); >+ my $can_item_4_be = CanItemBeReserved($patron,$item_4); >+ >+ my $can_be_all = { >+ %$can_book_be, >+ $item_1->itemnumber => $can_item_1_be, >+ $item_2->itemnumber => $can_item_2_be, >+ $item_3->itemnumber => $can_item_3_be, >+ $item_4->itemnumber => $can_item_4_be, >+ }; >+ >+ my $can_book_be_all = CanBookBeReserved($patron->borrowernumber,$item_1->biblionumber, undef, {return_all_items => 1}); >+ >+ is_deeply( $can_book_be_all, $can_be_all, "We get status for book and status per itemnumber when all requested"); >+ >+ t::lib::Mocks::mock_preference('AllowHoldsOnDamagedItems', 0); >+ $item_4->damaged(1)->store(); >+ $can_item_4_be = CanItemBeReserved($patron,$item_4); >+ my $can_be_all = { >+ %$can_book_be, >+ $item_1->itemnumber => $can_item_1_be, >+ $item_2->itemnumber => $can_item_2_be, >+ $item_3->itemnumber => $can_item_3_be, >+ $item_4->itemnumber => $can_item_4_be, >+ }; >+ $can_book_be_all = CanBookBeReserved($patron->borrowernumber,$item_1->biblionumber, undef, {return_all_items => 1}); >+ >+ is_deeply( $can_book_be_all, $can_be_all, "We get status for book and status per itemnumber when all requested"); >+ is( $can_book_be_all->{status}, 'OK', "When some can be reserved and some cannot we get 'OK'"); >+ >+ $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 30860
:
135426
|
135427
|
135428
|
135429
|
144480
|
144481
|
144482
|
144483
|
144506
|
144507
|
144508
|
144509
|
145577
|
145578
|
145579
|
145580
|
145581
|
145582
|
145583
|
145584
|
147695
|
148562
|
148812
|
149124
|
149377