Bug 26503: Add unit tests

Run
  prove t/db_dependent/Acquisition.t

Verify all tests pass.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

JD Amended patch: perltidy

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Katrin Fischer 2020-09-21 05:52:27 +00:00 committed by Jonathan Druart
parent 352e8d2306
commit bd2087e1cd
1 changed files with 42 additions and 1 deletions

View File

@ -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,45 @@ 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();