Bug 17575: Remove itemtype-related warnings from Circulation.t
authorTomas Cohen Arazi <tomascohen@theke.io>
Mon, 7 Nov 2016 19:00:21 +0000 (16:00 -0300)
committerKyle M Hall <kyle@bywatersolutions.com>
Sat, 12 Nov 2016 02:36:10 +0000 (02:36 +0000)
To test:
- Run:
  $ prove t/db_dependent/Circulation.t
=> FAIL: Lots of warnings
- Apply the patch
- Run:
  $ prove t/db_dependent/Circulation.t
=> SUCCESS: All green and no itemtype warnings
- Sign off :-D

Sponsored-by: ByWater Solutions
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
t/db_dependent/Circulation.t

index 723c27b..0fe2872 100755 (executable)
@@ -54,6 +54,11 @@ my $library = $builder->build({
 my $library2 = $builder->build({
     source => 'Branch',
 });
+my $itemtype = $builder->build(
+    {   source => 'Itemtype',
+        value  => { notforloan => undef, rentalcharge => 0 }
+    }
+)->{itemtype};
 
 my $CircControl = C4::Context->preference('CircControl');
 my $HomeOrHoldingBranch = C4::Context->preference('HomeOrHoldingBranch');
@@ -219,7 +224,8 @@ C4::Context->dbh->do("DELETE FROM accountlines");
             homebranch       => $branch,
             holdingbranch    => $branch,
             barcode          => $barcode,
-            replacementprice => 12.00
+            replacementprice => 12.00,
+            itype            => $itemtype
         },
         $biblionumber
     );
@@ -230,7 +236,8 @@ C4::Context->dbh->do("DELETE FROM accountlines");
             homebranch       => $branch,
             holdingbranch    => $branch,
             barcode          => $barcode2,
-            replacementprice => 23.00
+            replacementprice => 23.00,
+            itype            => $itemtype
         },
         $biblionumber
     );
@@ -241,7 +248,8 @@ C4::Context->dbh->do("DELETE FROM accountlines");
             homebranch       => $branch,
             holdingbranch    => $branch,
             barcode          => $barcode3,
-            replacementprice => 23.00
+            replacementprice => 23.00,
+            itype            => $itemtype
         },
         $biblionumber
     );
@@ -394,7 +402,7 @@ C4::Context->dbh->do("DELETE FROM accountlines");
     ModItem({ notforloan => 1 }, $biblionumber, $itemnumber);
     ( $renewokay, $error ) = CanBookBeRenewed($renewing_borrowernumber, $itemnumber, 1);
     is( $renewokay, 1, 'Can renew, item is marked not for loan, hold does not block');
-    ModItem({ notforloan => 0, itype => '' }, $biblionumber, $itemnumber,1);
+    ModItem({ notforloan => 0, itype => $itemtype }, $biblionumber, $itemnumber,1);
 
     # FIXME: Add more for itemtype not for loan etc.
 
@@ -405,7 +413,8 @@ C4::Context->dbh->do("DELETE FROM accountlines");
             homebranch       => $branch,
             holdingbranch    => $branch,
             barcode          => $barcode5,
-            replacementprice => 23.00
+            replacementprice => 23.00,
+            itype            => $itemtype
         },
         $biblionumber
     );
@@ -425,7 +434,8 @@ C4::Context->dbh->do("DELETE FROM accountlines");
             homebranch       => $branch,
             holdingbranch    => $branch,
             barcode          => $barcode6,
-            replacementprice => 23.00
+            replacementprice => 23.00,
+            itype            => $itemtype
         },
         $biblionumber
     );
@@ -436,7 +446,8 @@ C4::Context->dbh->do("DELETE FROM accountlines");
             homebranch       => $branch,
             holdingbranch    => $branch,
             barcode          => $barcode7,
-            replacementprice => 23.00
+            replacementprice => 23.00,
+            itype            => $itemtype
         },
         $biblionumber
     );
@@ -485,7 +496,8 @@ C4::Context->dbh->do("DELETE FROM accountlines");
             homebranch       => $branch,
             holdingbranch    => $branch,
             barcode          => $barcode4,
-            replacementprice => 16.00
+            replacementprice => 16.00,
+            itype            => $itemtype
         },
         $biblionumber
     );
@@ -726,7 +738,8 @@ C4::Context->dbh->do("DELETE FROM accountlines");
         {
             homebranch       => $branch,
             holdingbranch    => $branch,
-            barcode          => $barcode3
+            barcode          => $barcode3,
+            itype            => $itemtype
         },
         $biblionumber2
     );
@@ -805,7 +818,8 @@ C4::Context->dbh->do("DELETE FROM accountlines");
         {
             homebranch       => $branch,
             holdingbranch    => $branch,
-            barcode          => $barcode
+            barcode          => $barcode,
+            itype            => $itemtype
         },
         $biblionumber
     );
@@ -861,6 +875,7 @@ C4::Context->dbh->do("DELETE FROM accountlines");
             homebranch    => $library2->{branchcode},
             holdingbranch => $library2->{branchcode},
             barcode       => $barcode1,
+            itype         => $itemtype
         },
         $biblionumber
     );
@@ -870,6 +885,7 @@ C4::Context->dbh->do("DELETE FROM accountlines");
             homebranch    => $library2->{branchcode},
             holdingbranch => $library2->{branchcode},
             barcode       => $barcode2,
+            itype         => $itemtype
         },
         $biblionumber
     );
@@ -946,6 +962,7 @@ C4::Context->dbh->do("DELETE FROM accountlines");
             homebranch       => $branch,
             holdingbranch    => $branch,
             barcode          => $barcode,
+            itype            => $itemtype
         },
         $biblionumber
     );
@@ -976,6 +993,7 @@ C4::Context->dbh->do("DELETE FROM accountlines");
             homebranch       => $library->{branchcode},
             holdingbranch    => $library->{branchcode},
             barcode          => $barcode,
+            itype            => $itemtype
         },
         $biblionumber,
     );