Lines 202-208
subtest 'apply() tests' => sub {
Link Here
|
202 |
my $offsets = Koha::Account::Offsets->search( { credit_id => $credit->id, debit_id => $debit_1->id } ); |
202 |
my $offsets = Koha::Account::Offsets->search( { credit_id => $credit->id, debit_id => $debit_1->id } ); |
203 |
is( $offsets->count, 1, 'Only one offset is generated' ); |
203 |
is( $offsets->count, 1, 'Only one offset is generated' ); |
204 |
my $THE_offset = $offsets->next; |
204 |
my $THE_offset = $offsets->next; |
205 |
is( $THE_offset->amount * 1, 10, 'Amount was calculated correctly (less than the available credit)' ); |
205 |
is( $THE_offset->amount * 1, -10, 'Amount was calculated correctly (less than the available credit)' ); |
206 |
is( $THE_offset->type, 'Manual Credit', 'Passed type stored correctly' ); |
206 |
is( $THE_offset->type, 'Manual Credit', 'Passed type stored correctly' ); |
207 |
|
207 |
|
208 |
$debits = Koha::Account::Lines->search({ accountlines_id => $debit_2->id }); |
208 |
$debits = Koha::Account::Lines->search({ accountlines_id => $debit_2->id }); |
Lines 216-222
subtest 'apply() tests' => sub {
Link Here
|
216 |
$offsets = Koha::Account::Offsets->search( { credit_id => $credit->id, debit_id => $debit_2->id } ); |
216 |
$offsets = Koha::Account::Offsets->search( { credit_id => $credit->id, debit_id => $debit_2->id } ); |
217 |
is( $offsets->count, 1, 'Only one offset is generated' ); |
217 |
is( $offsets->count, 1, 'Only one offset is generated' ); |
218 |
$THE_offset = $offsets->next; |
218 |
$THE_offset = $offsets->next; |
219 |
is( $THE_offset->amount * 1, 90, 'Amount was calculated correctly (less than the available credit)' ); |
219 |
is( $THE_offset->amount * 1, -90, 'Amount was calculated correctly (less than the available credit)' ); |
220 |
is( $THE_offset->type, 'Credit Applied', 'Defaults to \'Credit Applied\' offset type' ); |
220 |
is( $THE_offset->type, 'Credit Applied', 'Defaults to \'Credit Applied\' offset type' ); |
221 |
|
221 |
|
222 |
$debits = Koha::Account::Lines->search({ accountlines_id => $debit_1->id }); |
222 |
$debits = Koha::Account::Lines->search({ accountlines_id => $debit_1->id }); |
223 |
- |
|
|