Lines 691-707
subtest 'reconcile_balance' => sub {
Link Here
|
691 |
|
691 |
|
692 |
subtest 'pay() tests' => sub { |
692 |
subtest 'pay() tests' => sub { |
693 |
|
693 |
|
694 |
plan tests => 6; |
694 |
plan tests => 7; |
695 |
|
695 |
|
696 |
$schema->storage->txn_begin; |
696 |
$schema->storage->txn_begin; |
697 |
|
697 |
|
698 |
# Disable renewing upon fine payment |
698 |
# Disable renewing upon fine payment |
699 |
t::lib::Mocks::mock_preference( 'RenewAccruingItemWhenPaid', 0 ); |
699 |
t::lib::Mocks::mock_preference( 'RenewAccruingItemWhenPaid', 0 ); |
700 |
|
700 |
|
|
|
701 |
|
701 |
my $patron = $builder->build_object({ class => 'Koha::Patrons' }); |
702 |
my $patron = $builder->build_object({ class => 'Koha::Patrons' }); |
702 |
my $library = $builder->build_object({ class => 'Koha::Libraries' }); |
703 |
my $library = $builder->build_object({ class => 'Koha::Libraries' }); |
703 |
my $account = $patron->account; |
704 |
my $account = $patron->account; |
704 |
|
705 |
|
|
|
706 |
t::lib::Mocks::mock_preference( 'RequirePaymentType', 1 ); |
707 |
throws_ok { |
708 |
$account->pay( |
709 |
{ |
710 |
amount => 5, |
711 |
interface => 'intranet' |
712 |
} |
713 |
); |
714 |
} |
715 |
'Koha::Exceptions::Account::PaymentTypeRequired', |
716 |
'Exception thrown for RequirePaymentType:1 + payment_type:undef'; |
717 |
|
718 |
t::lib::Mocks::mock_preference( 'RequirePaymentType', 0 ); |
705 |
my $context = Test::MockModule->new('C4::Context'); |
719 |
my $context = Test::MockModule->new('C4::Context'); |
706 |
$context->mock( 'userenv', { branch => $library->id } ); |
720 |
$context->mock( 'userenv', { branch => $library->id } ); |
707 |
|
721 |
|
Lines 714-720
subtest 'pay() tests' => sub {
Link Here
|
714 |
my $credit_2 = Koha::Account::Lines->find( $credit_2_id ); |
728 |
my $credit_2 = Koha::Account::Lines->find( $credit_2_id ); |
715 |
|
729 |
|
716 |
is( $credit_2->branchcode, $library->id, 'branchcode set because library_id was passed' ); |
730 |
is( $credit_2->branchcode, $library->id, 'branchcode set because library_id was passed' ); |
717 |
|
|
|
718 |
# Enable cash registers |
731 |
# Enable cash registers |
719 |
t::lib::Mocks::mock_preference( 'UseCashRegisters', 1 ); |
732 |
t::lib::Mocks::mock_preference( 'UseCashRegisters', 1 ); |
720 |
throws_ok { |
733 |
throws_ok { |
721 |
- |
|
|