From ae475eb15a4b1c8b5c49c1c4f79388c9e1d7686a Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Thu, 1 Oct 2020 14:33:46 +0100 Subject: [PATCH] Bug 26506: (QA follow-up) Add Unit Test Signed-off-by: Martin Renvoize Signed-off-by: Jonathan Druart --- t/db_dependent/Koha/Account.t | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/t/db_dependent/Koha/Account.t b/t/db_dependent/Koha/Account.t index 0941fbbca5..dd54fff601 100755 --- a/t/db_dependent/Koha/Account.t +++ b/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; }; -- 2.11.0