Bug 5786 - Move AllowOnShelfHolds and OPACItemHolds system prefs to the Circulation...
[koha.git] / t / 00-load.t
1 #!/usr/bin/perl
2
3 # This file is part of Koha.
4 #
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.
9 #
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.
14 #
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>.
17
18 use Modern::Perl;
19
20 use Test::More;
21 use File::Spec;
22 use File::Find;
23
24 use t::lib::Mocks;
25
26 =head1 DESCRIPTION
27
28 00-load.t: This script is called by the pre-commit git hook to test modules compile
29
30 =cut
31
32 my $context_module = t::lib::Mocks::mock_dbh;
33
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$//;
42
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'");
48     },
49 }, $lib);
50
51 # Loop through the Koha:: modules
52 $lib = File::Spec->rel2abs('Koha');
53 find(
54     {
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'");
64         },
65     },
66     $lib
67 );
68
69
70 done_testing();
71
72 1;