@@ -, +, @@ --- t/db_dependent/Koha/Account.t | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) --- a/t/db_dependent/Koha/Account.t +++ a/t/db_dependent/Koha/Account.t @@ -678,7 +678,7 @@ subtest 'reconcile_balance' => sub { subtest 'pay() tests' => sub { - plan tests => 3; + plan tests => 5; $schema->storage->txn_begin; @@ -719,6 +719,19 @@ subtest 'pay() tests' => sub { # Disable cash registers t::lib::Mocks::mock_preference( 'UseCashRegisters', 1 ); + # Undef userenv + $context->mock( 'userenv', undef ); + my $result = $account->pay( + { + amount => 20, + payment_Type => 'CASH', + interface => 'intranet' + } + ); + ok($result, "Koha::Account->pay functions without a userenv"); + my $payment = Koha::Account::Lines->find({accountlines_id => $result->{payment_id}}); + is($payment->manager_id, undef, "manager_id left undefined when no userenv found"); + $schema->storage->txn_rollback; }; --