From a751487f415266498a8d2bb579d94a5cc42ed197 Mon Sep 17 00:00:00 2001 From: Katrin Fischer Date: Mon, 21 Sep 2020 05:52:27 +0000 Subject: [PATCH] Bug 26503: Add unit tests Run prove t/db_dependent/Acquisition.t Verify all tests pass. Signed-off-by: David Nind Signed-off-by: Tomas Cohen Arazi --- t/db_dependent/Acquisition.t | 39 +++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/t/db_dependent/Acquisition.t b/t/db_dependent/Acquisition.t index 6028fea2b3d..97c6c3fb429 100755 --- a/t/db_dependent/Acquisition.t +++ b/t/db_dependent/Acquisition.t @@ -19,7 +19,7 @@ use Modern::Perl; use POSIX qw(strftime); -use Test::More tests => 79; +use Test::More tests => 80; use t::lib::Mocks; use Koha::Database; use Koha::DateUtils qw(dt_from_string output_pref); @@ -893,4 +893,41 @@ subtest 'GetHistory - managing library' => sub { }; +subtest 'GetHistory - is_standing' => sub { + + plan tests => 1; + + my $orders = GetHistory(is_standing => '1'); + + my $builder = t::lib::TestBuilder->new; + + my $order_basket1 = $builder->build({ source => 'Aqbasket', value => { is_standing => 0 } }); + my $orderinfo1 ={ + basketno => $order_basket1->{basketno}, + rrp => 19.99, + replacementprice => undef, + quantity => 1, + quantityreceived => 0, + datereceived => undef, + datecancellationprinted => undef, + }; + my $order1 = $builder->build({ source => 'Aqorder', value => $orderinfo1 }); + + my $order_basket2 = $builder->build({ source => 'Aqbasket', value => { is_standing => 1 } }); + my $orderinfo2 ={ + basketno => $order_basket2->{basketno}, + rrp => 19.99, + replacementprice => undef, + quantity => 1, + quantityreceived => 0, + datereceived => undef, + datecancellationprinted => undef, + }; + my $order2 = $builder->build({ source => 'Aqorder', value => $orderinfo2 }); + + my $history = GetHistory(is_standing => 1); + is( scalar( @$history), scalar ( @$orders ) +1, "GetHistory returns number of standing orders"); + +}; + $schema->storage->txn_rollback(); -- 2.28.0