From 7c4f526a86fffe21a88373f430952caca4dfc268 Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Mon, 21 Oct 2013 18:49:37 +0000 Subject: [PATCH] Bug 10723: (follow-up) add more unit tests for SearchOrders() In particular, verify that the pending filter option works. To test: [1] Verify that prove -v t/db_dependent/Acquisition.t passes Signed-off-by: Galen Charlton --- t/db_dependent/Acquisition.t | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/t/db_dependent/Acquisition.t b/t/db_dependent/Acquisition.t index 90d5a883ec..202641fc2f 100755 --- a/t/db_dependent/Acquisition.t +++ b/t/db_dependent/Acquisition.t @@ -8,7 +8,7 @@ use POSIX qw(strftime); use C4::Bookseller qw( GetBookSellerFromId ); -use Test::More tests => 41; +use Test::More tests => 44; BEGIN { use_ok('C4::Acquisition'); @@ -85,6 +85,7 @@ my $orders = SearchOrders({ pending => 1 }); isa_ok( $orders, 'ARRAY' ); +is(scalar(@$orders), 3, 'retrieved 3 pending orders'); C4::Acquisition::CloseBasket( $basketno ); my @lateorders = GetLateOrders(0); @@ -129,4 +130,20 @@ for my $field ( @expectedfields ) { ok( exists( $firstorder->{ $field } ), "This order has a $field field" ); } +# fake receiving the order +ModOrder({ + ordernumber => $firstorder->{ordernumber}, + biblionumber => $firstorder->{biblionumber}, + quantityreceived => $firstorder->{quantity}, +}); +my $pendingorders = SearchOrders({ + booksellerid => $booksellerid, + pending => 1 +}); +is(scalar(@$pendingorders), 2, 'retrieved 2 pending orders after receiving on one (bug 10723)'); +my $allorders = SearchOrders({ + booksellerid => $booksellerid, +}); +is(scalar(@$allorders), 3, 'retrieved all 3 orders even after after receiving on one (bug 10723)'); + $dbh->rollback; -- 2.39.5