Lines 19-25
Link Here
|
19 |
|
19 |
|
20 |
use Modern::Perl; |
20 |
use Modern::Perl; |
21 |
|
21 |
|
22 |
use Test::More tests => 4; |
22 |
use Test::More tests => 5; |
23 |
|
23 |
|
24 |
use t::lib::TestBuilder; |
24 |
use t::lib::TestBuilder; |
25 |
use t::lib::Mocks; |
25 |
use t::lib::Mocks; |
Lines 143-145
subtest 'invoice' => sub {
Link Here
|
143 |
|
143 |
|
144 |
$schema->storage->txn_rollback; |
144 |
$schema->storage->txn_rollback; |
145 |
}; |
145 |
}; |
146 |
- |
146 |
|
|
|
147 |
subtest 'subscription' => sub { |
148 |
plan tests => 2; |
149 |
|
150 |
$schema->storage->txn_begin; |
151 |
my $o = $builder->build_object( |
152 |
{ |
153 |
class => 'Koha::Acquisition::Orders', |
154 |
value => { subscriptionid => undef }, # not linked to a subscription |
155 |
} |
156 |
); |
157 |
|
158 |
my $order = Koha::Acquisition::Orders->find( $o->ordernumber ); |
159 |
is( $order->subscription, undef, |
160 |
'->subscription should return undef if not created from a subscription'); |
161 |
|
162 |
$o = $builder->build_object( |
163 |
{ |
164 |
class => 'Koha::Acquisition::Orders', |
165 |
# Will be linked to a subscription by TestBuilder |
166 |
} |
167 |
); |
168 |
|
169 |
$order = Koha::Acquisition::Orders->find( $o->ordernumber ); |
170 |
is( ref( $order->subscription ), 'Koha::Subscription', |
171 |
'->subscription should return a Koha::Subscription object if created from a subscription'); |
172 |
|
173 |
$schema->storage->txn_rollback; |
174 |
}; |