Lines 206-219
subtest 'add_credit() tests' => sub {
Link Here
|
206 |
# Enable logs |
206 |
# Enable logs |
207 |
t::lib::Mocks::mock_preference( 'FinesLog', 1 ); |
207 |
t::lib::Mocks::mock_preference( 'FinesLog', 1 ); |
208 |
|
208 |
|
209 |
my $sip_code = "1"; |
|
|
210 |
my $line_2 = $account->add_credit( |
209 |
my $line_2 = $account->add_credit( |
211 |
{ amount => 37, |
210 |
{ amount => 37, |
212 |
description => 'Payment of 37', |
211 |
description => 'Payment of 37', |
213 |
library_id => $patron->branchcode, |
212 |
library_id => $patron->branchcode, |
214 |
note => 'not really important', |
213 |
note => 'not really important', |
215 |
user_id => $patron->id, |
214 |
user_id => $patron->id, |
216 |
sip => $sip_code, |
|
|
217 |
interface => 'commandline' |
215 |
interface => 'commandline' |
218 |
} |
216 |
} |
219 |
); |
217 |
); |
Lines 221-227
subtest 'add_credit() tests' => sub {
Link Here
|
221 |
is( $account->balance, -62, 'Patron has a balance of -25' ); |
219 |
is( $account->balance, -62, 'Patron has a balance of -25' ); |
222 |
is( $schema->resultset('ActionLog')->count(), $action_logs + 1, 'Log was added' ); |
220 |
is( $schema->resultset('ActionLog')->count(), $action_logs + 1, 'Log was added' ); |
223 |
is( $schema->resultset('Statistic')->count(), $statistics + 2, 'Action added to statistics' ); |
221 |
is( $schema->resultset('Statistic')->count(), $statistics + 2, 'Action added to statistics' ); |
224 |
is( $line_2->accounttype, $Koha::Account::account_type_credit->{'payment'} . $sip_code, 'Account type is correctly set' ); |
222 |
is( $line_2->accounttype, $Koha::Account::account_type_credit->{'payment'}, 'Account type is correctly set' ); |
225 |
|
223 |
|
226 |
# offsets have the credit_id set to accountlines_id, and debit_id is undef |
224 |
# offsets have the credit_id set to accountlines_id, and debit_id is undef |
227 |
my $offset_1 = Koha::Account::Offsets->search({ credit_id => $line_1->id })->next; |
225 |
my $offset_1 = Koha::Account::Offsets->search({ credit_id => $line_1->id })->next; |
Lines 332-338
subtest 'add_debit() tests' => sub {
Link Here
|
332 |
# Enable logs |
330 |
# Enable logs |
333 |
t::lib::Mocks::mock_preference( 'FinesLog', 1 ); |
331 |
t::lib::Mocks::mock_preference( 'FinesLog', 1 ); |
334 |
|
332 |
|
335 |
my $sip_code = "1"; |
|
|
336 |
my $line_2 = $account->add_debit( |
333 |
my $line_2 = $account->add_debit( |
337 |
{ |
334 |
{ |
338 |
amount => 37, |
335 |
amount => 37, |
339 |
- |
|
|