Bug 40765

Summary: Acquisition tests will fail if order.quantity is set to 0
Product: Koha Reporter: Jonathan Druart <jonathan.druart>
Component: Test SuiteAssignee: Jonathan Druart <jonathan.druart>
Status: Pushed to main --- QA Contact: Lucas Gass (lukeg) <lucas>
Severity: major    
Priority: P5 - low CC: lucas, martin.renvoize, tomascohen
Version: unspecifiedKeywords: additional_work_needed
Hardware: All   
OS: All   
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
Bug 40765: Prevent acquisition tests to fail if order.quantity = 0
Bug 40765: Fix EDI.t

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.