Bug 26524: Unit tests

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Tomás Cohen Arazi 2020-09-23 15:56:32 -03:00 committed by Jonathan Druart
parent 41f0f22cb2
commit 00e01c5555

View file

@ -19,7 +19,7 @@
use Modern::Perl;
use Test::More tests => 9;
use Test::More tests => 10;
use t::lib::TestBuilder;
use t::lib::Mocks;
@ -271,3 +271,32 @@ subtest 'authorizer' => sub {
$schema->storage->txn_rollback;
};
subtest 'orders' => sub {
plan tests => 4;
$schema->storage->txn_begin;
my $basket = $builder->build_object(
{
class => 'Koha::Acquisition::Baskets'
}
);
my $orders = $basket->orders;
is( ref($orders), 'Koha::Acquisition::Orders', 'Type is correct with no attached orders' );
is( $orders->count, 0, 'No orders attached, count 0' );
my @actual_orders;
for ( 1..10 ) {
push @actual_orders, $builder->build_object({ class => 'Koha::Acquisition::Orders', value => { basketno => $basket->id } });
}
$orders = $basket->orders;
is( ref($orders), 'Koha::Acquisition::Orders', 'Type is correct with no attached orders' );
is( $orders->count, 10, '10 orders attached, count 10' );
$schema->storage->txn_rollback;
};