Bug 8383

Summary: Need test to check that Perl files will compile
Product: Koha Reporter: Jared Camins-Esakov <jcamins>
Component: Test SuiteAssignee: Jared Camins-Esakov <jcamins>
Status: CLOSED FIXED QA Contact: Mason James <mtj>
Severity: normal    
Priority: P1 - high CC: chris, f.demians, mtj, paul.poulain
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Attachments: Bug 8383: Add test to check that Perl scripts compile
Bug 8383: Add test to check that Perl scripts compile
Signed-off patch
Bug 8383: Add test to check that Perl scripts

Description Jared Camins-Esakov 2012-07-09 02:01:10 UTC
We have t/00-load.t to make sure that C4 and Koha modules can be loaded, but right now there is no test to prevent the inclusion of a Perl script that does not compile in Koha. There should be one.
Comment 1 Jared Camins-Esakov 2012-07-09 02:31:28 UTC Comment hidden (obsolete)
Comment 2 Chris Cormack 2012-07-09 02:57:03 UTC
I like it, except this does more than check they will compile.

eg
not ok 28 - Syntax check acqui/modordernotes.pl
#   Failed test 'Syntax check acqui/modordernotes.pl'
#   at /usr/share/perl5/Test/Strict.pm line 305.
# DBI connect('dbname=koha;host=localhost;port=3306','kohaadmin',...) failed: Access denied for user 'kohaadmin'@'localhost' (using password: YES) at C4/Context.pm line 758


Because they use C4::Context, to do a test like this we need a database, hence we need this script in t/db_dependent/
Comment 3 Jared Camins-Esakov 2012-07-09 11:46:05 UTC Comment hidden (obsolete)
Comment 4 Frédéric Demians 2012-07-09 17:13:45 UTC Comment hidden (obsolete)
Comment 5 Mason James 2012-07-09 20:26:54 UTC
(In reply to comment #4)
> Created attachment 10723 [details] [review]
> Signed-off patch

QA comment...

passing QA, patch applies and works perfect
Comment 6 Chris Cormack 2012-07-10 20:47:53 UTC
Very useful test, pushing to 3.8.x
Comment 7 Mason James 2013-03-26 18:15:13 UTC
(In reply to comment #6)
> Very useful test, pushing to 3.8.x

woops!, this patch missed out on getting pushed to master

Jared, i'll attach a rebased patch for master
Comment 8 Mason James 2013-03-26 18:22:11 UTC
Created attachment 16900 [details] [review]
Bug 8383: Add test to check that Perl scripts

This patch adds t/db_dependent/00-strict.pl which tests that all Perl
scripts compile. I chose to use Test::Strict so that in the future we
can also have the test check that "use strict" and "use warnings" are
enabled.

To test:
1. Run t/db_dependent/00-strict.pl.
2. Run around waving your arms in the air that we have a couple of
   scripts that don't compile.
3. Actually, that's about it. You could test my patch for bug 8384 next.

Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
Moved test to t/db_dependent

Signed-off-by: Frédéric Demians <f.demians@tamil.fr>
Comment 9 Mason James 2013-03-26 18:23:34 UTC
passing QA on this patch...
Comment 10 Jared Camins-Esakov 2013-03-28 02:09:37 UTC
This patch was pushed to master during the 3.10 release cycle.