Bug 40353: Remove warnings from Koha/Patron.t

C4::Context->userenv not defined! at /kohadevbox/koha/Koha/Patron.pm line 2152.
C4::Context->userenv not defined! at /kohadevbox/koha/Koha/Patron.pm line 2152.
C4::Context->userenv not defined! at /kohadevbox/koha/Koha/Patron.pm line 2152.

We need to mock the userenv

Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 3b1bc1bbc5)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
(cherry picked from commit b010fc5d49)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
Jonathan Druart 2025-07-11 15:01:57 +02:00 committed by Fridolin Somers
parent 2eb7815500
commit 202cf023e4
No known key found for this signature in database
GPG Key ID: 9A8E73E2A8B96537
1 changed files with 2 additions and 0 deletions

View File

@ -742,6 +742,8 @@ subtest 'to_api() tests' => sub {
}
);
t::lib::Mocks::mock_userenv( { patron => $consumer } );
my $restricted = $patron->to_api( { user => $consumer } )->{restricted};
ok( defined $restricted, 'restricted is defined' );
ok( !$restricted, 'debarred is undef, restricted evaluates to false' );