Bug 19120: Add tests to reproduce the problem
authorMark Tompsett <mtompset@hotmail.com>
Sat, 2 Sep 2017 01:21:40 +0000 (21:21 -0400)
committerKatrin Fischer <katrin.fischer.83@web.de>
Wed, 18 Oct 2017 21:15:33 +0000 (23:15 +0200)
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 <alexbuckley@catalyst.net.nz>

Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit d34fae94995977b730e4bbfc11bdecaa3ce310a8)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 1b8e2f600a51047191fca14bdaa19bca612887c9)
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

t/db_dependent/Acquisition/close_reopen_basket.t

index ac83f69..b06ba9a 100644 (file)
@@ -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();