Browse Source

Bug 30275: Add Unit test for renewals relation

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
22.11.x
Martin Renvoize 2 years ago
committed by Tomas Cohen Arazi
parent
commit
4e6a569c9c
Signed by: tomascohen GPG Key ID: 0A272EA1B2F3C15F
  1. 31
      t/db_dependent/Koha/Checkout.t

31
t/db_dependent/Koha/Checkout.t

@ -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;
};

Loading…
Cancel
Save