Bug 40765 - Acquisition tests will fail if order.quantity is set to 0
Summary: Acquisition tests will fail if order.quantity is set to 0
Status: Pushed to main
Alias: None
Product: Koha
Classification: Unclassified
Component: Test Suite (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low major
Assignee: Jonathan Druart
QA Contact: Lucas Gass (lukeg)
URL:
Keywords: additional_work_needed
Depends on:
Blocks:
 
Reported: 2025-09-08 08:37 UTC by Jonathan Druart
Modified: 2025-09-09 15:37 UTC (History)
3 users (show)

See Also:
GIT URL:
Change sponsored?: ---
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
25.11.00
Circulation function:


Attachments
Bug 40765: Prevent acquisition tests to fail if order.quantity = 0 (1.36 KB, patch)
2025-09-08 08:39 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 40765: Prevent acquisition tests to fail if order.quantity = 0 (1.41 KB, patch)
2025-09-08 17:34 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review
Bug 40765: Fix EDI.t (1.55 KB, patch)
2025-09-09 11:33 UTC, Jonathan Druart
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Druart 2025-09-08 08:37:18 UTC
When using TestBuilder to build an order the tests will fail when the object will be saved:

00:09:41 koha-1      |     # Looks like you planned 58 tests but ran 26.
00:09:41 koha-1      | 
00:09:41 koha-1      | #   Failed test 'cancel() tests'
00:09:41 koha-1      | #   at t/db_dependent/Koha/Acquisition/Order.t line 1042.
00:09:41 koha-1      | Cannot insert order: Mandatory parameter quantity is missing at t/db_dependent/Koha/Acquisition/Order.t line 868.
00:09:41 koha-1      | # Looks like your test exited with 255 just after 14.
00:09:41 koha-1      | [22:03:54] t/db_dependent/Koha/Acquisition/Order.t
Comment 1 Jonathan Druart 2025-09-08 08:39:18 UTC
Created attachment 186255 [details] [review]
Bug 40765: Prevent acquisition tests to fail if order.quantity = 0

When using TestBuilder to build an order the tests will fail when the object will be saved:

00:09:41 koha-1      |     # Looks like you planned 58 tests but ran 26.
00:09:41 koha-1      |
00:09:41 koha-1      | #   Failed test 'cancel() tests'
00:09:41 koha-1      | #   at t/db_dependent/Koha/Acquisition/Order.t line 1042.
00:09:41 koha-1      | Cannot insert order: Mandatory parameter quantity is missing at t/db_dependent/Koha/Acquisition/Order.t line 868.
00:09:41 koha-1      | # Looks like your test exited with 255 just after 14.
00:09:41 koha-1      | [22:03:54] t/db_dependent/Koha/Acquisition/Order.t

This happened on Koha_Main/3350
Comment 2 Lucas Gass (lukeg) 2025-09-08 17:34:15 UTC
Created attachment 186266 [details] [review]
Bug 40765: Prevent acquisition tests to fail if order.quantity = 0

When using TestBuilder to build an order the tests will fail when the object will be saved:

00:09:41 koha-1      |     # Looks like you planned 58 tests but ran 26.
00:09:41 koha-1      |
00:09:41 koha-1      | #   Failed test 'cancel() tests'
00:09:41 koha-1      | #   at t/db_dependent/Koha/Acquisition/Order.t line 1042.
00:09:41 koha-1      | Cannot insert order: Mandatory parameter quantity is missing at t/db_dependent/Koha/Acquisition/Order.t line 868.
00:09:41 koha-1      | # Looks like your test exited with 255 just after 14.
00:09:41 koha-1      | [22:03:54] t/db_dependent/Koha/Acquisition/Order.t

This happened on Koha_Main/3350

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Comment 3 Lucas Gass (lukeg) 2025-09-08 17:37:33 UTC
Nice work everyone! 

Pushed to main for 25.11.00
Comment 4 Jonathan Druart 2025-09-09 11:33:24 UTC
Created attachment 186282 [details] [review]
Bug 40765: Fix EDI.t

I have no idea why this is fixing the test!

Without this patch they fail:

t/db_dependent/Koha/EDI.t .. 1/5
    #   Failed test '14 log lines recorded for passed invoice file'
    #   at t/db_dependent/Koha/EDI.t line 725.
    #          got: '12'
    #     expected: '14'

    #   Failed test 'Warn recorded for transferring items'
    #   at t/db_dependent/Koha/EDI.t line 728.
    #                   'Unmatched item at branch:WID'
    #     doesn't match '(?^u:transferring.*)'

    #   Failed test 'Warn recorded for transferring items'
    #   at t/db_dependent/Koha/EDI.t line 728.
    #                   ''
    #     doesn't match '(?^u:transferring.*)'

    #   Failed test 'Warn recorded for unmatched item'
    #   at t/db_dependent/Koha/EDI.t line 728.
    #                   ''
    #     doesn't match '(?^u:Unmatched item at branch:.*)'
    # Looks like you failed 4 tests of 32.
Comment 5 Lucas Gass (lukeg) 2025-09-09 15:37:50 UTC
follow-up pushed to main.