Bug 7607: (follow-up) Address OPAC and limits
[koha.git] / misc / devel / coverage.pl
blob3dabae72bc976773cc2000e82353d6a3dd064ad8
1 #!/usr/bin/perl
3 # Copyright 2015 BibLibre
5 # This file is part of Koha.
7 # Koha is free software; you can redistribute it and/or modify it under the
8 # terms of the GNU General Public License as published by the Free Software
9 # Foundation; either version 3 of the License, or (at your option) any later
10 # version.
12 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License along
17 # with Koha; if not, see <http://www.gnu.org/licenses>.
19 =head1 NAME
21 coverage.pl
23 =head1 SYNOPSIS
25 misc/devel/coverage.pl [-h|--help]
27 This script must be run from your Koha source tree.
29 =head1 DESCRIPTION
31 This script runs all Koha tests and generates a coverage report on the
32 cover_db directory.
34 =cut
36 =head1 OPTIONS
38 =over 8
40 =item B<-h|--help>
42 prints this help text
44 =back
46 =cut
48 use Modern::Perl;
50 use C4::Context;
51 use Cwd;
52 use Getopt::Long;
53 use Pod::Usage;
55 my $help;
57 GetOptions(
58 "h|help" => \$help
61 pod2usage(1) if defined $help;
63 #Die if you are not in your Koha src directory
64 my $KOHA_PATH = C4::Context->config("intranetdir");
65 die "ERROR : You are not in Koha src/ directory"
66 unless $KOHA_PATH eq getcwd;
68 # Delete old coverage
69 system("cover -delete");
71 #Start the cover
72 system("PERL5OPT=-MDevel::Cover /usr/bin/prove -r t/");
74 #Create the HTML output
75 system("cover");
76 say("file://$KOHA_PATH/cover_db/coverage.html")
77 unless !-e "$KOHA_PATH/cover_db/coverage.html";