From d6f6db7c3d43cd68250d73a89de42e0bce06ec7f 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 --- 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.20.1