Bug 16869 - Silence and catch warnings in t/db_dependent/SuggestionEngine_ExplodedTerms.t
Summary: Silence and catch warnings in t/db_dependent/SuggestionEngine_ExplodedTerms.t
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Test Suite (show other bugs)
Version: Main
Hardware: All All
: P5 - low minor (vote)
Assignee: Mark Tompsett
QA Contact: Galen Charlton
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-07-07 06:34 UTC by Mark Tompsett
Modified: 2017-12-07 22:16 UTC (History)
4 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 16869: Silence and catch warnings in t/db_dependent/SuggestionEngine_ExplodedTerms.t (3.75 KB, patch)
2016-07-07 06:39 UTC, Mark Tompsett
Details | Diff | Splinter Review
[SIGNED-OFF]Bug 16869: Silence and catch warnings in t/db_dependent/SuggestionEngine_ExplodedTerms.t (3.86 KB, patch)
2016-07-07 13:57 UTC, Héctor Eduardo Castro Avalos
Details | Diff | Splinter Review
Bug 16869: Silence and catch warnings in t/db_dependent/SuggestionEngine_ExplodedTerms.t (3.90 KB, patch)
2016-07-07 14:09 UTC, Kyle M Hall
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Tompsett 2016-07-07 06:34:19 UTC
The warnings are triggered by a lack of opachtdocs, as the current mock function returns '', cascading C4::Template::themelanguage to fall through with no explicit return (turns out to be treated like '',undef,undef). This in turn sets the preferredtheme and lang to undef, which triggers the use of uninitialized values warning.

While trying to figure out the best way to fix this, bug 8846 was discovered. Attempting to unset $KOHA_CONF triggers warnings, because of the "use C4::Context;" in C4::Languages and C4::Templates.

prove t/db_dependent/SuggestionEngine_ExplodedTerms.t can reproduce the noise easily.
Comment 1 Mark Tompsett 2016-07-07 06:39:58 UTC Comment hidden (obsolete)
Comment 2 Héctor Eduardo Castro Avalos 2016-07-07 13:57:50 UTC Comment hidden (obsolete)
Comment 3 Kyle M Hall 2016-07-07 14:09:16 UTC
Created attachment 53169 [details] [review]
Bug 16869: Silence and catch warnings in t/db_dependent/SuggestionEngine_ExplodedTerms.t

By properly defining a opachtdocs (intranethtdocs was done too)
in the mock function, uninitialized variable warnings are
eliminated. Given that we can check if $KOHA_CONF is defined or
not, we can catch the warning as part of testing, so the output
of the test is cleaner.

TEST PLAN
---------
1) unset KOHA_CONF
2) prove t/db_dependent/SuggestionEngine_ExplodedTerms.t
   -- lots of noise
3) apply patch
4) prove t/db_dependent/SuggestionEngine_ExplodedTerms.t
   -- no noise
5) prove -v t/db_dependent/SuggestionEngine_ExplodedTerms.t
   -- see the warnings were caught and not just ignored.
6) run koha qa test tools

Signed-off-by: Hector Castro <hector.hecaxmmx@gmail.com>
No warnings. Works as advertised

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 4 Kyle M Hall 2016-07-08 13:08:33 UTC
Pushed to master for 16.11, thanks Mark!
Comment 5 Frédéric Demians 2016-08-01 13:27:57 UTC
Pushed in 16.05. Will be in 16.05.02.
Comment 6 Julian Maurice 2016-08-16 15:02:39 UTC
Patch pushed to 3.22.x, will be in 3.22.10