View | Details | Raw Unified | Return to bug 13274
Collapse All | Expand All

(-)a/t/00-load.t (-17 / +38 lines)
Lines 1-11 Link Here
1
# This script is called by the pre-commit git hook to test modules compile
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;
2
19
3
use strict;
4
use warnings;
5
use Test::More;
20
use Test::More;
6
use File::Spec;
21
use File::Spec;
7
use File::Find;
22
use File::Find;
23
use Test::MockModule;
24
use DBD::Mock;
25
26
=head1 DESCRIPTION
27
28
00-load.t: This script is called by the pre-commit git hook to test modules compile
8
29
30
=cut
31
32
# Mock the DB connexion and C4::Context
33
my $context = new Test::MockModule('C4::Context');
34
$context->mock( '_new_dbh', sub {
35
        my $dbh = DBI->connect( 'DBI:Mock:', '', '' )
36
          || die "Cannot create handle: $DBI::errstr\n";
37
        return $dbh;
38
});
39
40
# Loop through the C4:: modules
9
my $lib = File::Spec->rel2abs('C4');
41
my $lib = File::Spec->rel2abs('C4');
10
find({
42
find({
11
    bydepth => 1,
43
    bydepth => 1,
Lines 17-39 find({ Link Here
17
        $m =~ s{/}{::}g;
49
        $m =~ s{/}{::}g;
18
        return if $m =~ /Auth_with_ldap/; # Dont test this, it will fail on use
50
        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
51
        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::ILSDI::Services/; # DB
23
        return if $m =~ /C4::Tags$/; # DB
24
        return if $m =~ /C4::Service/; # DB
25
        return if $m =~ /C4::Auth_with_cas/; # DB
26
        return if $m =~ /C4::BackgroundJob/; # DB
27
        return if $m =~ /C4::UploadedFile/; # DB
28
        return if $m =~ /C4::Reports::Guided/; # DB
29
        return if $m =~ /C4::VirtualShelves::Page/; # DB
30
        return if $m =~ /C4::Members::Statistics/; # DB
31
        return if $m =~ /C4::Serials/; # needs context
32
        return if $m =~ /C4::Search::History/; # needs context
33
        use_ok($m) || BAIL_OUT("***** PROBLEMS LOADING FILE '$m'");
52
        use_ok($m) || BAIL_OUT("***** PROBLEMS LOADING FILE '$m'");
34
    },
53
    },
35
}, $lib);
54
}, $lib);
36
55
56
# Loop through the Koha:: modules
37
$lib = File::Spec->rel2abs('Koha');
57
$lib = File::Spec->rel2abs('Koha');
38
find(
58
find(
39
    {
59
    {
Lines 53-55 find( Link Here
53
73
54
74
55
done_testing();
75
done_testing();
56
- 
76
77
1;

Return to bug 13274