Bugzilla – Attachment 19177 Details for
Bug 10336
UT: HoldsQueue.t needs to create its own data
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 10336: HoldsQueue.t needs to create its own data
Bug-10336-HoldsQueuet-needs-to-create-its-own-data.patch (text/plain), 2.93 KB, created by
Jonathan Druart
on 2013-06-21 07:22:14 UTC
(
hide
)
Description:
Bug 10336: HoldsQueue.t needs to create its own data
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2013-06-21 07:22:14 UTC
Size:
2.93 KB
patch
obsolete
>From 1d8b7a0e87376bbf64f90433f338871a5d92b30f Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@biblibre.com> >Date: Fri, 24 May 2013 16:18:59 +0200 >Subject: [PATCH] Bug 10336: HoldsQueue.t needs to create its own data > >After applying this patch and the patch submitted in bug 10495, you can >run prove t/db_dependent/HoldsQueue.t and admire that all tests pass. > >This patch creates a borrower and uses Koha routines instead of directly >request the database. >--- > t/db_dependent/HoldsQueue.t | 44 ++++++++++++++++++++++++------------------- > 1 file changed, 25 insertions(+), 19 deletions(-) > >diff --git a/t/db_dependent/HoldsQueue.t b/t/db_dependent/HoldsQueue.t >index 7fb459a..d1bf287 100755 >--- a/t/db_dependent/HoldsQueue.t >+++ b/t/db_dependent/HoldsQueue.t >@@ -6,14 +6,18 @@ > # MySQL WARNING: This makes sense only if your tables are InnoDB, otherwise > # transactions are not supported and mess is left behind > >-use strict; >-use warnings; >+use Modern::Perl; >+ > use C4::Context; > > use Data::Dumper; > > use Test::More tests => 18; > >+use C4::Branch; >+use C4::ItemType; >+use C4::Members; >+ > BEGIN { > use FindBin; > use lib $FindBin::Bin; >@@ -21,28 +25,32 @@ BEGIN { > use_ok('C4::HoldsQueue'); > } > >-my $TITLE = "Test Holds Queue XXX"; >-# Pick a plausible borrower. Easier than creating one. >-my $BORROWER_QRY = <<EOQ; >-select * >-from borrowers >-where borrowernumber = (select max(borrowernumber) from issues) >-EOQ >+# Start transaction > my $dbh = C4::Context->dbh; >-my $borrower = $dbh->selectrow_hashref($BORROWER_QRY); >-my $borrowernumber = $borrower->{borrowernumber}; >+$dbh->{AutoCommit} = 0; >+$dbh->{RaiseError} = 1; >+ >+my $TITLE = "Test Holds Queue XXX"; >+ >+my %data = ( >+ cardnumber => 'CARDNUMBER42', >+ firstname => 'my firstname', >+ surname => 'my surname', >+ categorycode => 'S', >+ branchcode => 'CPL', >+); >+ >+my $borrowernumber = AddMember(%data); >+my $borrower = GetMember( borrowernumber => $borrowernumber ); > # Set special (for this test) branches > my $borrower_branchcode = $borrower->{branchcode}; >-my @other_branches = grep { $_ ne $borrower_branchcode } @{ $dbh->selectcol_arrayref("SELECT branchcode FROM branches") }; >+my @other_branches = grep { $_ ne $borrower_branchcode } keys GetBranches; > my $least_cost_branch_code = pop @other_branches > or BAIL_OUT("No point testing only one branch..."); >-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 > or BAIL_OUT("No adequate itemtype"); > >-# Start transaction >-$dbh->{AutoCommit} = 0; >-$dbh->{RaiseError} = 1; >- > #Set up the stage > # Sysprefs and cost matrix > $dbh->do("UPDATE systempreferences SET value = ? WHERE variable = 'StaticHoldsQueueWeight'", undef, >@@ -144,8 +152,6 @@ ok( $queue_item > # Cleanup > $dbh->rollback; > >-exit; >- > sub test_queue { > my ($test_name, $use_cost_matrix, $pick_branch, $hold_branch) = @_; > >-- >1.7.10.4
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 10336
:
18388
|
19167
|
19177
|
19179
|
19191
|
19256