Bug 30275: Add Unit test for renewals relation
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
parent
41a75bc76c
commit
4e6a569c9c
|
|
@ -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…
Reference in New Issue