Lines 19-25
Link Here
|
19 |
|
19 |
|
20 |
use Modern::Perl; |
20 |
use Modern::Perl; |
21 |
|
21 |
|
22 |
use Test::More tests => 3; |
22 |
use Test::More tests => 4; |
23 |
|
23 |
|
24 |
use t::lib::TestBuilder; |
24 |
use t::lib::TestBuilder; |
25 |
use t::lib::Mocks; |
25 |
use t::lib::Mocks; |
Lines 114-116
subtest 'fund' => sub {
Link Here
|
114 |
'->fund should return a Koha::Acquisition::Fund object' ); |
114 |
'->fund should return a Koha::Acquisition::Fund object' ); |
115 |
$schema->storage->txn_rollback; |
115 |
$schema->storage->txn_rollback; |
116 |
}; |
116 |
}; |
117 |
- |
117 |
|
|
|
118 |
subtest 'invoice' => sub { |
119 |
plan tests => 2; |
120 |
|
121 |
$schema->storage->txn_begin; |
122 |
my $o = $builder->build_object( |
123 |
{ |
124 |
class => 'Koha::Acquisition::Orders', |
125 |
value => { cancellationreason => 'XXXXXXXX', invoiceid => undef }, # not received yet |
126 |
} |
127 |
); |
128 |
|
129 |
my $order = Koha::Acquisition::Orders->find( $o->ordernumber ); |
130 |
is( $order->invoice, undef, |
131 |
'->invoice should return undef if no invoice defined yet'); |
132 |
|
133 |
my $invoice = $builder->build_object( |
134 |
{ |
135 |
class => 'Koha::Acquisition::Invoices', |
136 |
}, |
137 |
); |
138 |
|
139 |
$o->invoiceid( $invoice->invoiceid )->store; |
140 |
$order = Koha::Acquisition::Orders->find( $o->ordernumber ); |
141 |
is( ref( $order->invoice ), 'Koha::Acquisition::Invoice', |
142 |
'->invoice should return a Koha::Acquisition::Invoice object if an invoice is defined'); |
143 |
|
144 |
$schema->storage->txn_rollback; |
145 |
}; |