Lines 220-226
subtest 'apply() tests' => sub {
Link Here
|
220 |
is( $offsets->count, 1, 'Only one offset is generated' ); |
220 |
is( $offsets->count, 1, 'Only one offset is generated' ); |
221 |
my $THE_offset = $offsets->next; |
221 |
my $THE_offset = $offsets->next; |
222 |
is( $THE_offset->amount * 1, -10, 'Amount was calculated correctly (less than the available credit)' ); |
222 |
is( $THE_offset->amount * 1, -10, 'Amount was calculated correctly (less than the available credit)' ); |
223 |
is( $THE_offset->type, 'Manual Credit', 'Passed type stored correctly' ); |
223 |
is( $THE_offset->type, 'APPLY', 'Passed type stored correctly' ); |
224 |
|
224 |
|
225 |
$debits = Koha::Account::Lines->search({ accountlines_id => $debit_2->id }); |
225 |
$debits = Koha::Account::Lines->search({ accountlines_id => $debit_2->id }); |
226 |
$credit = $credit->apply( { debits => [ $debits->as_list ] } ); |
226 |
$credit = $credit->apply( { debits => [ $debits->as_list ] } ); |
Lines 266-272
subtest 'apply() tests' => sub {
Link Here
|
266 |
|
266 |
|
267 |
$debits = Koha::Account::Lines->search({ accountlines_id => { -in => [ $debit_1->id, $debit_2->id, $debit_3->id, $credit->id ] } }); |
267 |
$debits = Koha::Account::Lines->search({ accountlines_id => { -in => [ $debit_1->id, $debit_2->id, $debit_3->id, $credit->id ] } }); |
268 |
throws_ok { |
268 |
throws_ok { |
269 |
$credit_2->apply( { debits => [ $debits->as_list ] } |
269 |
$credit_2->apply( { debits => [ $debits->as_list ] }); } |
270 |
'Koha::Exceptions::Account::IsNotDebit', |
270 |
'Koha::Exceptions::Account::IsNotDebit', |
271 |
'->apply() rolls back if any of the passed lines is not a debit'; |
271 |
'->apply() rolls back if any of the passed lines is not a debit'; |
272 |
|
272 |
|
273 |
- |
|
|