Bug 11169: (follow-up) add more unit tests
authorGalen Charlton <gmc@esilibrary.com>
Wed, 28 May 2014 17:45:11 +0000 (17:45 +0000)
committerTomas Cohen Arazi <tomascohen@gmail.com>
Sun, 15 Jun 2014 14:12:34 +0000 (11:12 -0300)
This patch adds direct unit tests of the new biblionumber filter
for SearchOrders.  It also moves the ordernumber filter test
to the rest of the SearchOrders tests.

To test:

[1] Verify that prove -v t/db_dependent/Acquisition.t passes.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
t/db_dependent/Acquisition.t

index 8936ec4..837024a 100755 (executable)
@@ -8,7 +8,7 @@ use POSIX qw(strftime);
 
 use C4::Bookseller qw( GetBookSellerFromId );
 
-use Test::More tests => 77;
+use Test::More tests => 79;
 
 BEGIN {
     use_ok('C4::Acquisition');
@@ -727,6 +727,21 @@ $search_orders = SearchOrders({
 });
 is( scalar (@$search_orders), 0, "SearchOrders with pending and ordered params gets only pending ordered orders (bug 11170)" );
 
+$search_orders = SearchOrders({
+    ordernumber => $ordernumbers[4]
+});
+is( scalar (@$search_orders), 1, "SearchOrders takes into account the ordernumber filter" );
+
+$search_orders = SearchOrders({
+    biblionumber => $biblionumber4
+});
+is( scalar (@$search_orders), 1, "SearchOrders takes into account the biblionumber filter" );
+
+$search_orders = SearchOrders({
+    biblionumber => $biblionumber4,
+    pending      => 1
+});
+is( scalar (@$search_orders), 0, "SearchOrders takes into account the biblionumber and pending filters" );
 
 #
 # Test GetBudgetByOrderNumber
@@ -798,11 +813,6 @@ $search_orders = SearchOrders({
 });
 is( scalar (@$search_orders), 3, "SearchOrders with pending and ordered params gets only pending ordered orders. After closing the basket, orders are marked as 'ordered' (bug 11170)" );
 
-$search_orders = SearchOrders({
-    ordernumber => $ordernumbers[4]
-});
-is( scalar (@$search_orders), 1, "SearchOrders takes into account the ordernumber filter" );
-
 #
 # Test AddClaim
 #