Bug 13899: Adding misc/devel/coverage.pl
[koha.git] / misc / devel / coverage.pl
1 #!/usr/bin/perl
2
3 # Copyright 2015 BibLibre
4 # This file is part of Koha.
5 #
6 # Koha is free software; you can redistribute it and/or modify it under the
7 # terms of the GNU General Public License as published by the Free Software
8 # Foundation; either version 2 of the License, or (at your option) any later
9 # version.
10 #
11 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
12 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
13 # A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License along
16 # with Koha; if not, write to the Free Software Foundation, Inc.,
17 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
19 =head1 NAME
20
21 coverage.pl
22
23 =head1 SYNOPSIS
24
25 ./misc/devel/coverage.pl
26
27 =head1 DESCRIPTION
28
29 This script make a cover on all files to see which modules are not tested yet
30
31 =cut
32
33 use Modern::Perl;
34 use C4::Context;
35
36 my $KOHA_PATH = C4::Context->config("intranetdir");
37
38 chdir $KOHA_PATH;
39
40 eval{
41         require Devel::Cover;
42 };
43
44 if ($@) {
45         say "Devel::Cover needs to be installed";
46         exit 1;
47 }
48
49 #Delete old coverage
50 system("cover -delete");
51
52 #Start the cover
53 system("PERL5OPT=-MDevel::Cover /usr/bin/prove -r t/");
54
55 #Create the HTML output
56 system("cover");
57
58 say("file://$KOHA_PATH/cover_db/coverage.html");