Bug 30399 - Patron.t fails when there is a patron attribute that is mandatory
Summary: Patron.t fails when there is a patron attribute that is mandatory
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal
Assignee: Jonathan Druart
QA Contact: Katrin Fischer
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-03-29 16:46 UTC by Lucas Gass (lukeg)
Modified: 2023-12-28 20:42 UTC (History)
1 user (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
22.11.00, 22.05.03
Circulation function:


Attachments
Bug 30399: Make Patron.t pass even if mandatory attributes exist (2.28 KB, patch)
2022-06-08 09:41 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 30399: Make Patron.t pass even if mandatory attributes exist (2.32 KB, patch)
2022-06-08 16:35 UTC, David Nind
Details | Diff | Splinter Review
Bug 30399: Make Patron.t pass even if mandatory attributes exist (2.38 KB, patch)
2022-06-12 11:13 UTC, Katrin Fischer
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Lucas Gass (lukeg) 2022-03-29 16:46:36 UTC
I noticed this while testing another bug and this is happening to me while using koha-testing-docker.

To recreate:
1. sudo koha-shell kohadev
2. prove t/db_dependent/Koha/Patron.t
3. Tests pass.
4. Add a new patron attribute type and make it Mandatory by clicking the checkbox.
5. prove t/db_dependent/Koha/Patron.t

#   Failed test 'extended_attributes'
#   at t/db_dependent/Koha/Patron.t line 686.
Missing mandatory extended attribute (type=TEST)# Looks like your test exited with 255 just after 7.
t/db_dependent/Koha/Patron.t .. Dubious, test returned 255 (wstat 65280, 0xff00)
Failed 10/16 subtests 

Test Summary Report
-------------------
t/db_dependent/Koha/Patron.t (Wstat: 65280 Tests: 7 Failed: 1)
  Failed test:  7
  Non-zero exit status: 255
  Parse errors: Bad plan.  You planned 16 tests but ran 7.
Comment 1 Jonathan Druart 2022-06-08 09:41:28 UTC
Created attachment 135791 [details] [review]
Bug 30399: Make Patron.t pass even if mandatory attributes exist

t/db_dependent/Koha/Patron.t is failing if mandatory attributes already
exist in the DB. We can make it pass easily by deleting all the
attributes before we run the tests.

Test plan:
  prove t/db_dependent/Koha/Patron.t
must return green even if one mandatory patron attribute exists.
Comment 2 David Nind 2022-06-08 16:35:24 UTC
Created attachment 135824 [details] [review]
Bug 30399: Make Patron.t pass even if mandatory attributes exist

t/db_dependent/Koha/Patron.t is failing if mandatory attributes already
exist in the DB. We can make it pass easily by deleting all the
attributes before we run the tests.

Test plan:
  prove t/db_dependent/Koha/Patron.t
must return green even if one mandatory patron attribute exists.

Signed-off-by: David Nind <david@davidnind.com>
Comment 3 Katrin Fischer 2022-06-12 11:11:12 UTC
y
Comment 4 Katrin Fischer 2022-06-12 11:13:08 UTC
Created attachment 135968 [details] [review]
Bug 30399: Make Patron.t pass even if mandatory attributes exist

t/db_dependent/Koha/Patron.t is failing if mandatory attributes already
exist in the DB. We can make it pass easily by deleting all the
attributes before we run the tests.

Test plan:
  prove t/db_dependent/Koha/Patron.t
must return green even if one mandatory patron attribute exists.

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 5 Tomás Cohen Arazi (tcohen) 2022-06-13 13:38:27 UTC
Pushed to master for 22.11.

Nice work everyone, thanks!
Comment 6 Lucas Gass (lukeg) 2022-07-13 19:09:38 UTC
Backported to 22.05.x for 22.05.03