Bug 32240

Summary: api/erm_users.t fails if checkouts exist
Product: Koha Reporter: Jonathan Druart <jonathan.druart>
Component: Test SuiteAssignee: Jonathan Druart <jonathan.druart>
Status: CLOSED FIXED QA Contact: Martin Renvoize <martin.renvoize>
Severity: normal    
Priority: P5 - low CC: martin.renvoize, tomascohen
Version: unspecifiedKeywords: rel_22_11_candidate
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
22.11.00
Bug Depends on: 32030    
Bug Blocks:    
Attachments: Bug 32240: Prevent erm_users.t to fail if checkout exist
Bug 32240: Prevent erm_users.t to fail if checkout exist

Description Jonathan Druart 2022-11-17 08:51:39 UTC
DBIx::Class::Storage::DBI::_dbh_execute(): DBI Exception: DBD::mysql::st execute failed: Cannot delete or update a parent row: a foreign key constraint fails (`koha_kohadev`.`issues`, CONSTRAINT `issues_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON UPDATE CASCADE) at /kohadevbox/koha/Koha/Object.pm line 234
Comment 1 Jonathan Druart 2022-11-17 08:53:32 UTC
Created attachment 143985 [details] [review]
Bug 32240: Prevent erm_users.t to fail if checkout exist

We should not (never) remove all patrons before tests

Test plan:
0. Don't apply the patch
1. Check an item out
2. Run the tests
=> Fail
3. Apply the patch
4. Create a patron with the erm permission
5. Run the tests
=> Must return green
Comment 2 Martin Renvoize 2022-11-17 15:24:50 UTC
Created attachment 144005 [details] [review]
Bug 32240: Prevent erm_users.t to fail if checkout exist

We should not (never) remove all patrons before tests

Test plan:
0. Don't apply the patch
1. Check an item out
2. Run the tests
=> Fail
3. Apply the patch
4. Create a patron with the erm permission
5. Run the tests
=> Must return green

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 3 Tomás Cohen Arazi 2022-11-17 16:43:09 UTC
Pushed to master for 22.11.

Nice work everyone, thanks!