Lines 665-681
subtest 'reconcile_balance' => sub {
Link Here
|
665 |
|
665 |
|
666 |
subtest 'pay() tests' => sub { |
666 |
subtest 'pay() tests' => sub { |
667 |
|
667 |
|
668 |
plan tests => 6; |
668 |
plan tests => 7; |
669 |
|
669 |
|
670 |
$schema->storage->txn_begin; |
670 |
$schema->storage->txn_begin; |
671 |
|
671 |
|
672 |
# Disable renewing upon fine payment |
672 |
# Disable renewing upon fine payment |
673 |
t::lib::Mocks::mock_preference( 'RenewAccruingItemWhenPaid', 0 ); |
673 |
t::lib::Mocks::mock_preference( 'RenewAccruingItemWhenPaid', 0 ); |
674 |
|
674 |
|
|
|
675 |
|
675 |
my $patron = $builder->build_object({ class => 'Koha::Patrons' }); |
676 |
my $patron = $builder->build_object({ class => 'Koha::Patrons' }); |
676 |
my $library = $builder->build_object({ class => 'Koha::Libraries' }); |
677 |
my $library = $builder->build_object({ class => 'Koha::Libraries' }); |
677 |
my $account = $patron->account; |
678 |
my $account = $patron->account; |
678 |
|
679 |
|
|
|
680 |
t::lib::Mocks::mock_preference( 'RequirePaymentType', 1 ); |
681 |
throws_ok { |
682 |
$account->pay( |
683 |
{ |
684 |
amount => 5, |
685 |
interface => 'intranet' |
686 |
} |
687 |
); |
688 |
} |
689 |
'Koha::Exceptions::Account::PaymentTypeRequired', |
690 |
'Exception thrown for RequirePaymentType:1 + payment_type:undef'; |
691 |
|
692 |
t::lib::Mocks::mock_preference( 'RequirePaymentType', 0 ); |
679 |
my $context = Test::MockModule->new('C4::Context'); |
693 |
my $context = Test::MockModule->new('C4::Context'); |
680 |
$context->mock( 'userenv', { branch => $library->id } ); |
694 |
$context->mock( 'userenv', { branch => $library->id } ); |
681 |
|
695 |
|
Lines 688-694
subtest 'pay() tests' => sub {
Link Here
|
688 |
my $credit_2 = Koha::Account::Lines->find( $credit_2_id ); |
702 |
my $credit_2 = Koha::Account::Lines->find( $credit_2_id ); |
689 |
|
703 |
|
690 |
is( $credit_2->branchcode, $library->id, 'branchcode set because library_id was passed' ); |
704 |
is( $credit_2->branchcode, $library->id, 'branchcode set because library_id was passed' ); |
691 |
|
|
|
692 |
# Enable cash registers |
705 |
# Enable cash registers |
693 |
t::lib::Mocks::mock_preference( 'UseCashRegisters', 1 ); |
706 |
t::lib::Mocks::mock_preference( 'UseCashRegisters', 1 ); |
694 |
throws_ok { |
707 |
throws_ok { |
695 |
- |
|
|