Bugzilla – Attachment 127261 Details for
Bug 29015
Add option to limit Holds Queue report by shelving location / collection
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 29015: Unit tests
Bug-29015-Unit-tests.patch (text/plain), 4.02 KB, created by
Jonathan Druart
on 2021-11-03 13:52:17 UTC
(
hide
)
Description:
Bug 29015: Unit tests
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2021-11-03 13:52:17 UTC
Size:
4.02 KB
patch
obsolete
>From 6242c6bf1dcf418675ade432098535d10968dcd9 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Wed, 15 Sep 2021 10:34:15 +0000 >Subject: [PATCH] Bug 29015: Unit tests > >Signed-off-by: Owen Leonard <oleonard@myacpl.org> > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> > >JD Amended patch: perltidy! >--- > t/db_dependent/HoldsQueue.t | 84 ++++++++++++++++++++++++++++++++++++- > 1 file changed, 82 insertions(+), 2 deletions(-) > >diff --git a/t/db_dependent/HoldsQueue.t b/t/db_dependent/HoldsQueue.t >index 8014c65dd66..7067931c353 100755 >--- a/t/db_dependent/HoldsQueue.t >+++ b/t/db_dependent/HoldsQueue.t >@@ -8,7 +8,7 @@ > > use Modern::Perl; > >-use Test::More tests => 57; >+use Test::More tests => 58; > use Data::Dumper; > > use C4::Calendar qw( new insert_single_holiday ); >@@ -163,7 +163,7 @@ $dbh->do("DELETE FROM items WHERE holdingbranch = '$borrower_branchcode'"); > # Frst branch from StaticHoldsQueueWeight > test_queue ('take from lowest cost branch', 0, $borrower_branchcode, $other_branches[0]); > test_queue ('take from lowest cost branch', 1, $borrower_branchcode, $least_cost_branch_code); >-my $queue = C4::HoldsQueue::GetHoldsQueueItems($least_cost_branch_code) || []; >+my $queue = C4::HoldsQueue::GetHoldsQueueItems({ branchlmit => $least_cost_branch_code}) || []; > my $queue_item = $queue->[0]; > ok( $queue_item > && $queue_item->{pickbranch} eq $borrower_branchcode >@@ -1737,3 +1737,83 @@ subtest 'Remove holds on check-in match' => sub { > > $schema->storage->txn_rollback; > }; >+ >+subtest "GetHoldsQueueItems" => sub { >+ plan tests => 4; >+ >+ $schema->storage->txn_begin; >+ >+ my $ccode = $builder->build_object( >+ { >+ class => 'Koha::AuthorisedValues', >+ value => { >+ category => 'CCODE' >+ } >+ } >+ ); >+ my $location = $builder->build_object( >+ { >+ class => 'Koha::AuthorisedValues', >+ value => { >+ category => 'LOC' >+ } >+ } >+ ); >+ my $item_1 = $builder->build_sample_item(); >+ my $item_2 = $builder->build_sample_item( >+ { >+ itype => $item_1->itype, >+ ccode => $ccode->authorised_value >+ } >+ ); >+ my $item_3 = $builder->build_sample_item( >+ { >+ itype => $item_1->itype, >+ ccode => $item_2->ccode, >+ location => $location->authorised_value >+ } >+ ); >+ >+ my $itemnumber_1 = $item_1->itemnumber; >+ my $itemnumber_2 = $item_2->itemnumber; >+ my $itemnumber_3 = $item_3->itemnumber; >+ >+ my $biblionumber_1 = $item_1->biblionumber; >+ my $biblionumber_2 = $item_2->biblionumber; >+ my $biblionumber_3 = $item_3->biblionumber; >+ >+ my $sth = $dbh->prepare(q{ SELECT COUNT(*) FROM tmp_holdsqueue }); >+ $sth->execute(); >+ my ($count) = $sth->fetchrow_array; >+ >+ $dbh->do( " >+ INSERT INTO tmp_holdsqueue (itemnumber,biblionumber,surname,firstname,phone,borrowernumber,title,notes) VALUES >+ ($itemnumber_1,$biblionumber_1,'','','',22,'',''), >+ ($itemnumber_2,$biblionumber_2,'','','',32,'',''), >+ ($itemnumber_3,$biblionumber_3,'','','',42,'','') >+ " ); >+ >+ my $queue_items = GetHoldsQueueItems(); >+ is( scalar @$queue_items, $count + 3, 'Three items added to queue' ); >+ >+ $queue_items = GetHoldsQueueItems( { itemtypeslimit => $item_1->itype } ); >+ is( scalar @$queue_items, >+ 3, 'Three items of same itemtype found when itemtypeslimit passed' ); >+ >+ $queue_items = GetHoldsQueueItems( >+ { itemtypeslimit => $item_1->itype, ccodeslimit => $item_2->ccode } ); >+ is( scalar @$queue_items, >+ 2, 'Two items of same collection found when ccodeslimit passed' ); >+ >+ @$queue_items = GetHoldsQueueItems( >+ { >+ itemtypeslimit => $item_1->itype, >+ ccodeslimit => $item_2->ccode, >+ locationslimit => $item_3->location >+ } >+ ); >+ is( scalar @$queue_items, >+ 1, 'One item of shleving location found when locationslimit passed' ); >+ >+ $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 29015
:
124871
|
124881
|
124883
|
124903
|
124907
|
124908
|
124909
|
124910
|
124915
|
124916
|
124917
|
124918
|
125419
|
125420
|
125421
|
125422
|
125423
|
127191
|
127192
|
127193
|
127194
|
127195
|
127196
|
127197
|
127198
| 127261