Bug 30399

Summary: Patron.t fails when there is a patron attribute that is mandatory
Product: Koha Reporter: Lucas Gass (lukeg) <lucas>
Component: Architecture, internals, and plumbingAssignee: Jonathan Druart <jonathan.druart>
Status: CLOSED FIXED QA Contact: Katrin Fischer <katrin.fischer>
Severity: normal    
Priority: P5 - low CC: jonathan.druart
Version: Main   
Hardware: All   
OS: All   
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
Bug 30399: Make Patron.t pass even if mandatory attributes exist
Bug 30399: Make Patron.t pass even if mandatory attributes exist

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