|
Lines 54-79
subtest 'renewals() tests' => sub {
Link Here
|
| 54 |
plan tests => 2; |
54 |
plan tests => 2; |
| 55 |
$schema->storage->txn_begin; |
55 |
$schema->storage->txn_begin; |
| 56 |
|
56 |
|
| 57 |
my $checkout = $builder->build_object( |
57 |
my $checkout = $builder->build_object( { class => 'Koha::Checkouts' } ); |
| 58 |
{ |
|
|
| 59 |
class => 'Koha::Checkouts' |
| 60 |
} |
| 61 |
); |
| 62 |
my $renewal1 = $builder->build_object( |
58 |
my $renewal1 = $builder->build_object( |
| 63 |
{ |
59 |
{ |
| 64 |
class => 'Koha::Checkouts::Renewals', |
60 |
class => 'Koha::Checkouts::Renewals', |
| 65 |
value => { checkout_id => $checkout->issue_id } |
61 |
value => { checkout_id => undef } |
| 66 |
} |
62 |
} |
| 67 |
); |
63 |
); |
|
|
64 |
$renewal1->checkout_id( $checkout->issue_id )->store(); |
| 68 |
my $renewal2 = $builder->build_object( |
65 |
my $renewal2 = $builder->build_object( |
| 69 |
{ |
66 |
{ |
| 70 |
class => 'Koha::Checkouts::Renewals', |
67 |
class => 'Koha::Checkouts::Renewals', |
| 71 |
value => { checkout_id => $checkout->issue_id } |
68 |
value => { checkout_id => undef } |
| 72 |
} |
69 |
} |
| 73 |
); |
70 |
); |
|
|
71 |
$renewal2->checkout_id( $checkout->issue_id )->store(); |
| 74 |
|
72 |
|
| 75 |
is( ref($checkout->renewals), 'Koha::Checkouts::Renewals', 'Object set type is correct' ); |
73 |
is( ref( $checkout->renewals ), 'Koha::Checkouts::Renewals', 'Object set type is correct' ); |
| 76 |
is( $checkout->renewals->count, 2, "Count of renewals is correct" ); |
74 |
is( $checkout->renewals->count, 2, "Count of renewals is correct" ); |
| 77 |
|
75 |
|
| 78 |
$schema->storage->txn_rollback; |
76 |
$schema->storage->txn_rollback; |
| 79 |
}; |
77 |
}; |