Bugzilla – Attachment 46911 Details for
Bug 15391
HoldsQueue.t does not handle for loan itemtypes correctly
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 15391: Fix HoldsQueue.t tests
Bug-15391-Fix-HoldsQueuet-tests.patch (text/plain), 2.12 KB, created by
Jonathan Druart
on 2016-01-19 17:00:43 UTC
(
hide
)
Description:
Bug 15391: Fix HoldsQueue.t tests
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2016-01-19 17:00:43 UTC
Size:
2.12 KB
patch
obsolete
>From af148e16f7a6eaf30076ae086f1feffe8786cb75 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 19 Jan 2016 16:58:07 +0000 >Subject: [PATCH] Bug 15391: Fix HoldsQueue.t tests > >Prior to this patch, in HoldsQueue.t: > 63 my @item_types = C4::ItemType->all; > 64 my $itemtype = grep { $_->{notforloan} == 1 } @item_types > 65 or BAIL_OUT("No adequate itemtype"); > >Then we use the $itemtype variable (which contains the number of item types not for loan): > > 92 $dbh->do("INSERT INTO biblioitems (biblionumber, marcxml, itemtype) > 93 VALUES ($biblionumber, '', '$itemtype')"); > >There is obviously something wrong here. > >The code should be > > 64 my @not_for_loan = grep { $_->{notforloan} == 1 } @item_types > 65 or BAIL_OUT("No adequate itemtype"); > 66 my $itemtype = $not_for_loan[0]->{itemtype}; > >But then some tests don't pass: > >Actually the problem comes from: >commit bfbc646fdd9ca4b90a0bc2751d0faa95d9e93ba1 > Bug 10336: HoldsQueue.t needs to create its own data > >-my $itemtype = $dbh->selectrow_array("SELECT min(itemtype) FROM itemtypes WHERE notforloan = 0") >+my @item_types = C4::ItemType->all; >+my $itemtype = grep { $_->{notforloan} == 1 } @item_types > >The line should have been: >my $itemtype = grep { $_->{notforloan} == 0 } @item_types > >Test plan: >Confirm that the tests still pass after this patch applied. >--- > t/db_dependent/HoldsQueue.t | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/HoldsQueue.t b/t/db_dependent/HoldsQueue.t >index fb26c11..85c00b7 100755 >--- a/t/db_dependent/HoldsQueue.t >+++ b/t/db_dependent/HoldsQueue.t >@@ -61,8 +61,9 @@ my @branchcodes = ( $library1->{branchcode}, $library2->{branchcode}, $library3- > my @other_branches = ( $library2->{branchcode}, $library3->{branchcode} ); > my $least_cost_branch_code = pop @other_branches; > my @item_types = C4::ItemType->all; >-my $itemtype = grep { $_->{notforloan} == 1 } @item_types >+my @for_loan = grep { $_->{notforloan} == 0 } @item_types > or BAIL_OUT("No adequate itemtype"); >+my $itemtype = $for_loan[0]->{itemtype}; > > #Set up the stage > # Sysprefs and cost matrix >-- >2.1.0
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 15391
:
46911
|
46990
|
47061