Bug 16671: [QA Follow-up] Replace remaining itemtype lines
authorMarcel de Rooy <m.de.rooy@rijksmuseum.nl>
Tue, 28 Jun 2016 13:21:53 +0000 (15:21 +0200)
committerKyle M Hall <kyle@bywatersolutions.com>
Fri, 8 Jul 2016 12:47:14 +0000 (12:47 +0000)
Instead of relying on existing data, we use new TestBuilder recs.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
t/db_dependent/HoldsQueue.t

index 5302b47..056edb5 100755 (executable)
@@ -17,12 +17,9 @@ use C4::Context;
 use C4::Members;
 use Koha::Database;
 use Koha::DateUtils;
-use Koha::ItemType;
 
 use t::lib::TestBuilder;
 
-use Koha::ItemTypes;
-
 BEGIN {
     use FindBin;
     use lib $FindBin::Bin;
@@ -178,7 +175,7 @@ $dbh->do("DELETE FROM default_circ_rules");
 
 C4::Context->set_preference('UseTransportCostMatrix', 0);
 
-$itemtype = Koha::ItemTypes->search->next->itemtype;
+$itemtype = $builder->build({ source => 'Itemtype', value => { notforloan => 0 } })->{itemtype};
 
 $library1 = $builder->build({
     source => 'Branch',
@@ -337,7 +334,7 @@ is( scalar( @$holds_queue ), 2, "Holds not filled with items from closed librari
 C4::Context->set_preference( 'HoldsQueueSkipClosed', 0 );
 
 # Bug 14297
-$itemtype = Koha::ItemTypes->search->next->itemtype;
+$itemtype = $builder->build({ source => 'Itemtype', value => { notforloan => 0 } })->{itemtype};
 $borrowernumber = $borrower3->{borrowernumber};
 my $library_A = $library1->{branchcode};
 my $library_B = $library2->{branchcode};
@@ -394,7 +391,7 @@ is( @$holds_queue, 1, "Bug 14297 - Holds Queue building ignoring holds where pic
 # End Bug 14297
 
 # Bug 15062
-$itemtype = Koha::ItemTypes->search->next->itemtype;
+$itemtype = $builder->build({ source => 'Itemtype', value => { notforloan => 0 } })->{itemtype};
 $borrowernumber = $borrower2->{borrowernumber};
 $library_A = $library1->{branchcode};
 $library_B = $library2->{branchcode};
@@ -555,9 +552,8 @@ CancelReserve( { reserve_id => $reserve_id } );
 
 # Test hold itemtype limit
 C4::Context->set_preference( "UseTransportCostMatrix", 0 );
-my @itemtypes = Koha::ItemTypes->search();
-my $wrong_itemtype = $itemtypes[0]->itemtype;
-my $right_itemtype = $itemtypes[1]->itemtype;
+my $wrong_itemtype = $builder->build({ source => 'Itemtype', value => { notforloan => 0 } })->{itemtype};
+my $right_itemtype = $builder->build({ source => 'Itemtype', value => { notforloan => 0 } })->{itemtype};
 $borrowernumber = $borrower3->{borrowernumber};
 my $branchcode = $library1->{branchcode};
 $dbh->do("DELETE FROM reserves");