Bug 30275: Add Unit test for renewals relation

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Martin Renvoize 2022-04-28 11:55:32 +01:00 committed by Tomas Cohen Arazi
parent 41a75bc76c
commit 4e6a569c9c
No known key found for this signature in database
GPG Key ID: 0A272EA1B2F3C15F
1 changed files with 30 additions and 1 deletions

View File

@ -19,7 +19,7 @@
use Modern::Perl;
use Test::More tests => 1;
use Test::More tests => 2;
use t::lib::TestBuilder;
use Koha::Database;
@ -48,3 +48,32 @@ subtest 'library() tests' => sub {
$schema->storage->txn_rollback;
};
subtest 'renewals() tests' => sub {
plan tests => 2;
$schema->storage->txn_begin;
my $checkout = $builder->build_object(
{
class => 'Koha::Checkouts'
}
);
my $renewal1 = $builder->build_object(
{
class => 'Koha::Checkouts::Renewals',
value => { checkout_id => $checkout->issue_id }
}
);
my $renewal2 = $builder->build_object(
{
class => 'Koha::Checkouts::Renewals',
value => { checkout_id => $checkout->issue_id }
}
);
is( ref($checkout->renewals), 'Koha::Checkouts::Renewals', 'Object set type is correct' );
is( $checkout->renewals->count, 2, "Count of renewals is correct" );
$schema->storage->txn_rollback;
};