$dbh->do("INSERT INTO tmp_holdsqueue (surname,borrowernumber,itemnumber) VALUES ('Clamp',42,$itemnumber)"); This is really ugly :) Especially if you dont have the sample patrons with borrower 42..
Test::Builder::subtest(): DBI Exception: DBD::mysql::db do failed: Cannot add or update a child row: a foreign key constraint fails (`koha_myclone`.`tmp_holdsqueue`, CONSTRAINT `tmp_holdsqueue_ibfk_3` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE) at /usr/share/perl/5.32/Test/More.pm line 809
Apart from a simple fix for 41, it also stumbles on a missing 51 later on for safe_to_delete. Can't call method "can_edit_items_from" on an undefined value at /usr/share/koha/Koha/Item.pm line 299.
Created attachment 156234 [details] [review] Bug 34918: Fix hardcoded borrowernumber 42 Test plan: Run t/db_dependent/Koha/Item.t
WIP: The problem with safe_to_delete must be solved too.
Created attachment 156281 [details] [review] Bug 34918: Fix hardcoded borrowernumber 42 Test plan: Run t/db_dependent/Koha/Item.t Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Created attachment 156282 [details] [review] Bug 34918: Fix userenv for safe_to_delete tests Instead of the fallback to 51, we pass a borrower that has permission for editing items. Test plan: Do not apply patch. Run test without a borrower 51 in db. (FAIL) Apply patch. Run test again. (PASS) Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Trivial: Self SO.
Created attachment 156382 [details] [review] Bug 34918: Fix hardcoded borrowernumber 42 Test plan: Run t/db_dependent/Koha/Item.t Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Created attachment 156383 [details] [review] Bug 34918: Fix userenv for safe_to_delete tests Instead of the fallback to 51, we pass a borrower that has permission for editing items. Test plan: Do not apply patch. Run test without a borrower 51 in db. (FAIL) Apply patch. Run test again. (PASS) Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Pushed to master for 23.11. Nice work everyone, thanks!
Pushed to 23.05.x for 23.05.05
Nice work everyone! Pushed to oldstable for 22.11.x