Lines 158-164
subtest 'outstanding_credits() tests' => sub {
Link Here
|
158 |
|
158 |
|
159 |
subtest 'add_credit() tests' => sub { |
159 |
subtest 'add_credit() tests' => sub { |
160 |
|
160 |
|
161 |
plan tests => 16; |
161 |
plan tests => 17; |
162 |
|
162 |
|
163 |
$schema->storage->txn_begin; |
163 |
$schema->storage->txn_begin; |
164 |
|
164 |
|
Lines 231-237
subtest 'add_credit() tests' => sub {
Link Here
|
231 |
is( $offset_2->debit_id, undef, 'No debit_id is set for credits' ); |
231 |
is( $offset_2->debit_id, undef, 'No debit_id is set for credits' ); |
232 |
|
232 |
|
233 |
my $line_3 = $account->add_credit( |
233 |
my $line_3 = $account->add_credit( |
234 |
{ amount => 20, |
234 |
{ |
|
|
235 |
amount => 20, |
235 |
description => 'Manual credit applied', |
236 |
description => 'Manual credit applied', |
236 |
library_id => $patron->branchcode, |
237 |
library_id => $patron->branchcode, |
237 |
user_id => $patron->id, |
238 |
user_id => $patron->id, |
Lines 243-248
subtest 'add_credit() tests' => sub {
Link Here
|
243 |
is( $schema->resultset('ActionLog')->count(), $action_logs + 2, 'Log was added' ); |
244 |
is( $schema->resultset('ActionLog')->count(), $action_logs + 2, 'Log was added' ); |
244 |
is( $schema->resultset('Statistic')->count(), $statistics + 2, 'No action added to statistics, because of credit type' ); |
245 |
is( $schema->resultset('Statistic')->count(), $statistics + 2, 'No action added to statistics, because of credit type' ); |
245 |
|
246 |
|
|
|
247 |
# Enable cash registers |
248 |
t::lib::Mocks::mock_preference( 'UseCashRegisters', 1 ); |
249 |
throws_ok { |
250 |
$account->add_credit( |
251 |
{ |
252 |
amount => 20, |
253 |
description => 'Cash payment without cash register', |
254 |
library_id => $patron->branchcode, |
255 |
user_id => $patron->id, |
256 |
payment_type => 'CASH', |
257 |
interface => 'intranet' |
258 |
} |
259 |
); |
260 |
} |
261 |
'Koha::Exceptions::Account::RegisterRequired', |
262 |
'Exception thrown for UseCashRegisters:1 + payment_type:CASH + cash_register:undef'; |
263 |
|
264 |
# Disable cash registers |
265 |
t::lib::Mocks::mock_preference( 'UseCashRegisters', 1 ); |
266 |
|
246 |
$schema->storage->txn_rollback; |
267 |
$schema->storage->txn_rollback; |
247 |
}; |
268 |
}; |
248 |
|
269 |
|
Lines 560-566
subtest 'reconcile_balance' => sub {
Link Here
|
560 |
|
581 |
|
561 |
subtest 'pay() tests' => sub { |
582 |
subtest 'pay() tests' => sub { |
562 |
|
583 |
|
563 |
plan tests => 2; |
584 |
plan tests => 3; |
564 |
|
585 |
|
565 |
$schema->storage->txn_begin; |
586 |
$schema->storage->txn_begin; |
566 |
|
587 |
|
Lines 581-586
subtest 'pay() tests' => sub {
Link Here
|
581 |
|
602 |
|
582 |
is( $credit_2->branchcode, $library->id, 'branchcode set because library_id was passed' ); |
603 |
is( $credit_2->branchcode, $library->id, 'branchcode set because library_id was passed' ); |
583 |
|
604 |
|
|
|
605 |
# Enable cash registers |
606 |
t::lib::Mocks::mock_preference( 'UseCashRegisters', 1 ); |
607 |
throws_ok { |
608 |
$account->pay( |
609 |
{ |
610 |
amount => 20, |
611 |
payment_type => 'CASH', |
612 |
interface => 'intranet' |
613 |
} |
614 |
); |
615 |
} |
616 |
'Koha::Exceptions::Account::RegisterRequired', |
617 |
'Exception thrown for UseCashRegisters:1 + payment_type:CASH + cash_register:undef'; |
618 |
|
619 |
# Disable cash registers |
620 |
t::lib::Mocks::mock_preference( 'UseCashRegisters', 1 ); |
621 |
|
584 |
$schema->storage->txn_rollback; |
622 |
$schema->storage->txn_rollback; |
585 |
}; |
623 |
}; |
586 |
|
624 |
|
587 |
- |
|
|