]> git.koha-community.org Git - koha.git/blob - t/db_dependent/00-strict.t
Bug 19403: Prevent Circulation.t to fail randomly
[koha.git] / t / db_dependent / 00-strict.t
1 # This script is called by the pre-commit git hook to test modules compile
2
3 use strict;
4 use warnings;
5 use Module::Load::Conditional qw[can_load check_install requires];
6 use Test::More;
7 use Test::Strict;
8 use File::Spec;
9 use File::Find;
10 use lib("misc/translator");
11 use lib("installer");
12
13 my @dirs = ( 'acqui', 'admin', 'authorities', 'basket',
14     'catalogue', 'cataloguing', 'changelanguage.pl', 'circ', 'debian', 'docs',
15     'edithelp.pl', 'errors', 'fix-perl-path.PL', 'help.pl', 'installer',
16     'koha_perl_deps.pl', 'kohaversion.pl', 'labels',
17     'mainpage.pl', 'Makefile.PL', 'members', 'misc', 'offline_circ', 'opac',
18     'patroncards', 'reports', 'reserve', 'reviews',
19     'rewrite-config.PL', 'rotating_collections', 'serials', 'services', 'skel',
20     'sms', 'suggestion', 'svc', 'tags', 'tools', 'virtualshelves' );
21
22 $Test::Strict::TEST_STRICT = 0;
23
24 my $general_skips = [ 'misc/kohalib.pl', 'sms/sms_listen_windows_start.pl', 'misc/plack/koha.psgi' ];
25 my $elastic_search_files = [ 'misc/search_tools/rebuild_elastic_search.pl' ];
26 my @skips;
27 push @skips,@$general_skips;
28 if ( ! can_load(
29     modules => { 'Koha::SearchEngine::Elasticsearch::Indexer' => undef, } )
30 ) {
31     my $missing_module;
32     if ( $Module::Load::Conditional::ERROR =~ /Can\'t locate (.*?) / ) {
33         $missing_module = $1;
34     }
35     my $es_dep_msg = "Required module $missing_module is not installed";
36     diag $es_dep_msg;
37     my $skip_what_msg = "Skipping: " . join ',', @$elastic_search_files;
38     diag $skip_what_msg;
39     push @skips, @$elastic_search_files;
40 }
41 push @$Test::Strict::TEST_SKIP, @skips;
42
43 all_perl_files_ok(@dirs);