Bug 19024: Add tests
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Wed, 9 Aug 2017 19:09:32 +0000 (16:09 -0300)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Fri, 1 Sep 2017 16:02:24 +0000 (13:02 -0300)
Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
t/db_dependent/Acquisition/close_reopen_basket.t

index aba4824..750f1c5 100644 (file)
@@ -2,7 +2,7 @@
 
 use Modern::Perl;
 
-use Test::More tests => 6;
+use Test::More tests => 10;
 use C4::Acquisition;
 use C4::Biblio qw( AddBiblio DelBiblio );
 use C4::Budgets;
@@ -82,4 +82,13 @@ C4::Acquisition::ReopenBasket( $basketno );
 is ( scalar( map { $_->{orderstatus} eq 'ordered' ? 1 : () } @orders ), 0, "No order are ordered, the basket is reopen" );
 is ( scalar( map { $_->{orderstatus} eq 'new' ? 1 : () } @orders ), 2, "2 orders are new, the basket is reopen" );
 
+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' );
+
 $schema->storage->txn_rollback();