Bug 40401 - Implement Koha::Patron->is_anonymous (was t/db_dependent/Auth.t generates warnings)
Summary: Implement Koha::Patron->is_anonymous (was t/db_dependent/Auth.t generates war...
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Test Suite (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low enhancement
Assignee: Jonathan Druart
QA Contact: Martin Renvoize (ashimema)
URL:
Keywords:
Depends on: 40353
Blocks: 40444
  Show dependency treegraph
 
Reported: 2025-07-16 07:46 UTC by Jonathan Druart
Modified: 2025-08-29 21:57 UTC (History)
3 users (show)

See Also:
GIT URL:
Change sponsored?: ---
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
25.11.00,25.05.02
Circulation function:


Attachments
Bug 40401: Implement Koha::Patron->is_anonymous (9.95 KB, patch)
2025-07-16 08:06 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 40401: Implement Koha::Patron->is_anonymous (10.00 KB, patch)
2025-07-18 07:48 UTC, David Nind
Details | Diff | Splinter Review
Bug 40401: Implement Koha::Patron->is_anonymous (10.07 KB, patch)
2025-07-18 12:01 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 40401: (follow-up) Fix grammar and rollback in tests (1.39 KB, patch)
2025-07-18 12:01 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Druart 2025-07-16 07:46:45 UTC
t/db_dependent/Auth.t .. 1/23 Use of uninitialized value $anonymous_patron in string eq at /kohadevbox/koha/C4/Auth.pm line 1497.
Use of uninitialized value $anonymous_patron in string eq at /kohadevbox/koha/C4/Auth.pm line 1497.       
Use of uninitialized value $anonymous_patron in string eq at /kohadevbox/koha/C4/Auth.pm line 1497.
Comment 1 Jonathan Druart 2025-07-16 08:06:59 UTC
Created attachment 184123 [details] [review]
Bug 40401: Implement Koha::Patron->is_anonymous

The first motivation of this patch is to remove the following warnings
from t/db_dependent/Auth.t:
Use of uninitialized value $anonymous_patron in string eq at /kohadevbox/koha/C4/Auth.pm line 1497

Actually a correct fix seems to add a new `is_anonymous` method to
Koha::Patron in order to remove the warnings from everywhere else.

Test plan:
Confirm that you cannot log in using the anonymous patron and that the 2
tests are passing
  prove t/db_dependent/Auth.t t/db_dependent/Koha/Patron.t
Comment 2 David Nind 2025-07-18 07:48:37 UTC
Created attachment 184294 [details] [review]
Bug 40401: Implement Koha::Patron->is_anonymous

The first motivation of this patch is to remove the following warnings
from t/db_dependent/Auth.t:
Use of uninitialized value $anonymous_patron in string eq at /kohadevbox/koha/C4/Auth.pm line 1497

Actually a correct fix seems to add a new `is_anonymous` method to
Koha::Patron in order to remove the warnings from everywhere else.

Test plan:
Confirm that you cannot log in using the anonymous patron and that the 2
tests are passing
  prove t/db_dependent/Auth.t t/db_dependent/Koha/Patron.t

Signed-off-by: David Nind <david@davidnind.com>
Comment 3 Martin Renvoize (ashimema) 2025-07-18 12:01:44 UTC
Created attachment 184353 [details] [review]
Bug 40401: Implement Koha::Patron->is_anonymous

The first motivation of this patch is to remove the following warnings
from t/db_dependent/Auth.t:
Use of uninitialized value $anonymous_patron in string eq at /kohadevbox/koha/C4/Auth.pm line 1497

Actually a correct fix seems to add a new `is_anonymous` method to
Koha::Patron in order to remove the warnings from everywhere else.

Test plan:
Confirm that you cannot log in using the anonymous patron and that the 2
tests are passing
  prove t/db_dependent/Auth.t t/db_dependent/Koha/Patron.t

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Comment 4 Martin Renvoize (ashimema) 2025-07-18 12:01:46 UTC
Created attachment 184354 [details] [review]
Bug 40401: (follow-up) Fix grammar and rollback in tests

- Fixed grammar: "Returns true if the patron is the anonymous patron"
- Fixed test cleanup: use txn_rollback instead of txn_begin
- Fixed test subroutine closure syntax

Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Comment 5 Lucas Gass (lukeg) 2025-07-21 20:03:51 UTC
Nice work everyone!

Pushed to main for 25.11
Comment 6 Paul Derscheid 2025-07-24 19:03:46 UTC
Nice work everyone!

Pushed to 25.05.x
Comment 7 Fridolin Somers 2025-08-01 13:46:26 UTC
Enhancement not pushed to 24.11.x
Comment 8 David Nind 2025-08-29 21:57:55 UTC
Test suite changes, no changes to the manual required.