Translation updates for Koha 3.22.0-beta release
[koha.git] / t / 00-load.t
blob21b62ebb504c49b36d8ac52e43faf892f9bfc37c
1 #!/usr/bin/perl
3 # This file is part of Koha.
5 # Koha is free software; you can redistribute it and/or modify it
6 # under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 3 of the License, or
8 # (at your option) any later version.
10 # Koha is distributed in the hope that it will be useful, but
11 # WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with Koha; if not, see <http://www.gnu.org/licenses>.
18 use Modern::Perl;
20 use Test::More;
21 use File::Spec;
22 use File::Find;
24 use t::lib::Mocks;
26 =head1 DESCRIPTION
28 00-load.t: This script is called by the pre-commit git hook to test modules compile
30 =cut
32 my $context_module = t::lib::Mocks::mock_dbh;
34 # Loop through the C4:: modules
35 my $lib = File::Spec->rel2abs('C4');
36 find({
37 bydepth => 1,
38 no_chdir => 1,
39 wanted => sub {
40 my $m = $_;
41 return unless $m =~ s/[.]pm$//;
43 $m =~ s{^.*/C4/}{C4/};
44 $m =~ s{/}{::}g;
45 return if $m =~ /Auth_with_ldap/; # Dont test this, it will fail on use
46 return if $m =~ /SIPServer/; # SIP Server module has old package usage
47 use_ok($m) || BAIL_OUT("***** PROBLEMS LOADING FILE '$m'");
49 }, $lib);
51 # Loop through the Koha:: modules
52 $lib = File::Spec->rel2abs('Koha');
53 find(
55 bydepth => 1,
56 no_chdir => 1,
57 wanted => sub {
58 my $m = $_;
59 return unless $m =~ s/[.]pm$//;
60 $m =~ s{^.*/Koha/}{Koha/};
61 $m =~ s{/}{::}g;
62 return if $m =~ /Koha::NorwegianPatronDB/; # uses non-mandatory modules
63 use_ok($m) || BAIL_OUT("***** PROBLEMS LOADING FILE '$m'");
66 $lib
70 done_testing();