File Coverage

File:t/00-load.t
Coverage:97.7%

linestmtbrancondsubtimecode
1# This script is called by the pre-commit git hook to test modules compile
2
3
1
1
1
1.33283492734839e+15
1
41
use strict;
4
1
1
1
5
1
31
use warnings;
5
1
1
1
291
23002
14
use Test::More;
6
1
1
1
371
3
36
use File::Spec;
7
1
1
1
400
12839
56535
use File::Find;
8
9
1
148608
my $lib = File::Spec->rel2abs('C4');
10find({
11    bydepth => 1,
12    no_chdir => 1,
13    wanted => sub {
14
208
86808
        my $m = $_;
15
208
2098
            return unless $m =~ s/[.]pm$//;
16
150
931
            $m =~ s{^.*/C4/}{C4/};
17
150
1043
            $m =~ s{/}{::}g;
18
150
768
            return if $m =~ /Auth_with_ldap/; # Dont test this, it will fail on use
19
149
753
            return if $m =~ /Cache/; # Cache modules are a WIP, add the tests back when we are using them more
20
146
818
            return if $m =~ /SIP/; # SIP modules will not load clean
21
126
654
            return if $m =~ /C4::VirtualShelves$/; # Requires a DB
22
125
588
            return if $m =~ /C4::Auth$/; # DB
23
124
642
            return if $m =~ /C4::Tags$/; # DB
24
123
570
            return if $m =~ /C4::Service/; # DB
25
122
495
            return if $m =~ /C4::Auth_with_cas/; # DB
26
121
683
            return if $m =~ /C4::BackgroundJob/; # DB
27
120
456
            return if $m =~ /C4::UploadedFile/; # DB
28
119
453
            return if $m =~ /C4::Record/; # DB
29
118
420
            return if $m =~ /C4::Reports::Guided/; # DB
30
117
413
            return if $m =~ /C4::Serials/; # DB
31
116
361
            return if $m =~ /C4::VirtualShelves::Page/; # DB
32
115
944
        use_ok($m) || BAIL_OUT("***** PROBLEMS LOADING FILE '$m'");
33    },
34
1
57
}, $lib);
35
36
1
101
$lib = File::Spec->rel2abs('Koha');
37find(
38    {
39        bydepth => 1,
40        no_chdir => 1,
41        wanted => sub {
42
6
2564
            my $m = $_;
43
6
48
            return unless $m =~ s/[.]pm$//;
44
3
12
            $m =~ s{^.*/Koha/}{Koha/};
45
3
15
            $m =~ s{/}{::}g;
46
3
20
            use_ok($m) || BAIL_OUT("***** PROBLEMS LOADING FILE '$m'");
47        },
48    },
49
1
24
    $lib
50);
51
52
53
1
43
done_testing();