https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42418

--- Comment #118 from Tomás Cohen Arazi (tcohen) <[email protected]> ---
Created attachment 209005
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=209005&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)

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list -- [email protected]
To unsubscribe send an email to [email protected]
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to