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:
parent
41f0f22cb2
commit
00e01c5555
1 changed files with 30 additions and 1 deletions
|
@ -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;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue