Bug 8300: Add mechanized unit test for batch import
[koha.git] / t / 00-load.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 Test::More;
6 use File::Spec;
7 use File::Find;
8
9 my $lib = File::Spec->rel2abs('C4');
10 find({
11     bydepth => 1,
12     no_chdir => 1,
13     wanted => sub {
14         my $m = $_;
15         return unless $m =~ s/[.]pm$//;
16         $m =~ s{^.*/C4/}{C4/};
17         $m =~ s{/}{::}g;
18         return if $m =~ /Auth_with_ldap/; # Dont test this, it will fail on use
19         return if $m =~ /SIP/; # SIP modules will not load clean
20         return if $m =~ /C4::VirtualShelves$/; # Requires a DB
21         return if $m =~ /C4::Auth$/; # DB
22         return if $m =~ /C4::Tags$/; # DB
23         return if $m =~ /C4::Service/; # DB
24         return if $m =~ /C4::Auth_with_cas/; # DB
25         return if $m =~ /C4::BackgroundJob/; # DB
26         return if $m =~ /C4::UploadedFile/; # DB
27         return if $m =~ /C4::Reports::Guided/; # DB
28         return if $m =~ /C4::VirtualShelves::Page/; # DB
29         return if $m =~ /C4::Members::Statistics/; # DB
30         use_ok($m) || BAIL_OUT("***** PROBLEMS LOADING FILE '$m'");
31     },
32 }, $lib);
33
34 $lib = File::Spec->rel2abs('Koha');
35 find(
36     {
37         bydepth  => 1,
38         no_chdir => 1,
39         wanted   => sub {
40             my $m = $_;
41             return unless $m =~ s/[.]pm$//;
42             $m =~ s{^.*/Koha/}{Koha/};
43             $m =~ s{/}{::}g;
44             return if $m =~ /Koha::SearchEngine/; # Koha::SearchEngine::* are experimental
45             use_ok($m) || BAIL_OUT("***** PROBLEMS LOADING FILE '$m'");
46         },
47     },
48     $lib
49 );
50
51
52 done_testing();