From 8884545ef632b746436a8117348de150e93071af Mon Sep 17 00:00:00 2001 From: Mark Tompsett Date: Fri, 1 Sep 2017 21:21:40 -0400 Subject: [PATCH] Bug 19120: Add tests to reproduce the problem TEST PLAN --------- 1) apply this patch 2) prove t/db_dependent/Acquisition/close_reopen_basket.t -- FAILS! -- This proves the test works. 3) run koha qa test tools Followed test plan, patch worked as described Signed-off-by: Alex Buckley Signed-off-by: Julian Maurice Signed-off-by: Jonathan Druart (cherry picked from commit d34fae94995977b730e4bbfc11bdecaa3ce310a8) Signed-off-by: Fridolin Somers (cherry picked from commit 1b8e2f600a51047191fca14bdaa19bca612887c9) Signed-off-by: Katrin Fischer --- t/db_dependent/Acquisition/close_reopen_basket.t | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/t/db_dependent/Acquisition/close_reopen_basket.t b/t/db_dependent/Acquisition/close_reopen_basket.t index ac83f69b82..b06ba9a628 100644 --- a/t/db_dependent/Acquisition/close_reopen_basket.t +++ b/t/db_dependent/Acquisition/close_reopen_basket.t @@ -2,7 +2,7 @@ use Modern::Perl; -use Test::More tests => 10; +use Test::More tests => 14; use C4::Acquisition; use C4::Biblio qw( AddBiblio DelBiblio ); use C4::Bookseller; @@ -86,9 +86,19 @@ C4::Acquisition::DelOrder( $biblionumber1, $ordernumber1 ); my ( $order ) = C4::Acquisition::GetOrders( $basketno, {cancelled => 1} ); is( $order->{ordernumber}, $ordernumber1, 'The order returned by GetOrders should have been the right one' ); is( $order->{orderstatus}, 'cancelled', 'DelOrder should have set status to cancelled' ); + C4::Acquisition::CloseBasket( $basketno ); ( $order ) = C4::Acquisition::GetOrders( $basketno, {cancelled => 1} ); is( $order->{ordernumber}, $ordernumber1, 'The order returned by GetOrders should have been the right one' ); is( $order->{orderstatus}, 'cancelled', 'CloseBasket should not reset the status to ordered for cancelled orders' ); +C4::Acquisition::ReopenBasket( $basketno ); +( $order ) = C4::Acquisition::GetOrders( $basketno, {cancelled => 1} ); +is( $order->{ordernumber}, $ordernumber1, 'The expected order is cancelled, the basket is reopened' ); +is( $order->{orderstatus}, 'cancelled', 'ReopenBasket should not reset the status for cancelled orders' ); + +( $order ) = C4::Acquisition::GetOrders( $basketno, { cancelled => 0 } ); +is ( $order->{ordernumber}, $ordernumber2, "The expect order is not cancelled, the basket is reopened" ); +is ( $order->{orderstatus}, 'new', 'The expected order is new, the basket is reopened' ); + $schema->storage->txn_rollback(); -- 2.39.5