https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42418 --- Comment #150 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- Created attachment 209427 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=209427&action=edit Bug 42418: (follow-up) Fix more tests using a stale mock_userenv AddReturn now creates a Koha::Checkin record whose user_id is a FK to borrowers. Two more tests ran AddReturn with a userenv pointing to a patron that had already been rolled back: * t/db_dependent/Koha/Checkouts.t: 'automatic_checkin' runs after the file-level transaction rollback, so the librarian mocked in 'filter_by_todays_checkins' no longer exists * t/db_dependent/Patron/Borrower_PrevCheckout.t: 'Check previous checkouts with delay' inherits the patron mocked (and rolled back) by the 'serial' subtest Both raised a 'Broken FK constraint' exception. This patch mocks the userenv with a valid patron in those subtests. Test plan: 1. Without this patch, run: $ ktd --shell k$ prove t/db_dependent/Koha/Checkouts.t \ t/db_dependent/Patron/Borrower_PrevCheckout.t => FAIL: Broken FK constraint storing Koha::Checkin 2. Apply this patch 3. Repeat step 1 => SUCCESS: Tests pass! 4. Sign off :-D Assisted-by: Opus 5.5 (Anthropic) Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org> -- You are receiving this mail because: You are watching all bug changes.