Bug 24361

Summary: Fix warnings (or failing tests) from bug 24217
Product: Koha Reporter: Jonathan Druart <jonathan.druart>
Component: Test SuiteAssignee: Jonathan Druart <jonathan.druart>
Status: RESOLVED FIXED QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: joy, martin.renvoize
Version: unspecified   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Who signed the patch off: Text to go in the release notes:
Version(s) released in:
20.05.00
Bug Depends on: 24217    
Bug Blocks:    
Attachments: Bug 24361: Fix warning in C4::Record line 435
Bug 24361: (bug 24217 follow-up) Fix several warnings in C4 modules
Bug 24361: (follow-up) Fix CalcFine.t
Bug 24361: Remove warning from GetAgeRestriction
Bug 24361: Silent t/db_dependent/Items.t
Bug 24361: Silent Items/GetItemsForInventory.t

Description Jonathan Druart 2020-01-07 11:25:21 UTC
We added use Modern::Perl to some of our modules, we should expect warnings in logs or test failing
Comment 1 Jonathan Druart 2020-01-07 11:27:48 UTC
Created attachment 96873 [details] [review]
Bug 24361: Fix warning in C4::Record line 435

Use of uninitialized value in concatenation (.) or string at /kohadevbox/koha/C4/Record.pm line 435

Caught by a failing test:
    #   Failed test 'Export csv with wrong marcxml should raise a warning'
    #   at t/db_dependent/Exporter/Record.t line 113.
    # found warning:  problem with :721 : :1: parser error : Start tag expected, '<' not found
    # found warning: Use of uninitialized value in concatenation (.) or string at /kohadevbox/koha/C4/Record.pm line 435.
    # expected to find warning: (?^u:.*Start tag expected.*)

Test plan:
Make sure the tests pass now
Comment 2 Jonathan Druart 2020-01-07 13:20:33 UTC
Created attachment 96892 [details] [review]
Bug 24361: (bug 24217 follow-up) Fix several warnings in C4 modules

With bug 24217 pushed, lot of warnings appears during the tests are run.
Most of them are "Use of uninitialized value in "

Test plan:
Take a look at the output of run 1049
https://jenkins.koha-community.org/job/Koha_Master_D9/1049/consoleFull

Most of the warnings from this run will be removed by this patch

At least 2 are not fixed:
Use of uninitialized value in numeric eq (==) at /kohadevbox/koha/C4/Reserves.pm line 791.
t/db_dependent/Items_DelItemCheck.t => see 23463
Comment 3 Martin Renvoize 2020-01-07 14:01:28 UTC
Code is sensible and tests are improved.. passing qa for a quick push whilst we work on the final two failures.
Comment 4 Martin Renvoize 2020-01-07 14:02:04 UTC
First two patches pushed to master.
Comment 5 Jonathan Druart 2020-01-07 21:54:42 UTC
Created attachment 96969 [details] [review]
Bug 24361: (follow-up) Fix CalcFine.t

I mixed up 2 possible solutions, the "not defined" is handled by the "! defined $item->{replacementprice}" part

t/db_dependent/Circulation/CalcFine.t .. 1/3
    #   Failed test 'Amount is calculated correctly'
    #   at t/db_dependent/Circulation/CalcFine.t line 167.
    #          got: '29'
    #     expected: '6'
    # Looks like you failed 1 test of 2.
Comment 6 Jonathan Druart 2020-01-13 14:36:42 UTC
Created attachment 97315 [details] [review]
Bug 24361: Remove warning from GetAgeRestriction

Use of uninitialized value $record_restrictions in uc at /kohadevbox/koha/C4/Circulation.pm line 3981
Comment 7 Martin Renvoize 2020-01-13 14:49:26 UTC
 Bug 24361: Remove warning from GetAgeRestriction - Pushed to master
Comment 8 Jonathan Druart 2020-01-13 14:57:57 UTC
(In reply to Jonathan Druart from comment #5)
> Created attachment 96969 [details] [review] [review]
> Bug 24361: (follow-up) Fix CalcFine.t
> 
> I mixed up 2 possible solutions, the "not defined" is handled by the "!
> defined $item->{replacementprice}" part
> 
> t/db_dependent/Circulation/CalcFine.t .. 1/3
>     #   Failed test 'Amount is calculated correctly'
>     #   at t/db_dependent/Circulation/CalcFine.t line 167.
>     #          got: '29'
>     #     expected: '6'
>     # Looks like you failed 1 test of 2.

This has been pushed too, different title however "Bug 24361: (RM follow-up) Restore 0 handling in CalcFine"
Comment 9 Joy Nelson 2020-01-14 01:04:40 UTC
not backported to 19.11.x
Comment 10 Jonathan Druart 2020-01-27 16:44:15 UTC
Created attachment 97991 [details] [review]
Bug 24361: Silent t/db_dependent/Items.t

its output is displaying tons of
Use of uninitialized value $field in regexp compilation at /kohadevbox/koha/C4/Items.pm line 2106.
Comment 11 Martin Renvoize 2020-01-27 18:57:55 UTC
Bug 24361: Silent t/db_dependent/Items.t  pushed to master
Comment 12 Jonathan Druart 2020-02-13 09:31:19 UTC
Created attachment 98796 [details] [review]
Bug 24361: Silent Items/GetItemsForInventory.t

It was displaying undreds of:
Use of uninitialized value in concatenation (.) or string at
/kohadevbox/koha/C4/Items.pm line 862.
Comment 13 Martin Renvoize 2020-02-13 09:34:27 UTC
Bug 24361: Silent Items/GetItemsForInventory.t Pushed to master