Bug 13690: use Koha::Schema only when it's needed
[koha.git] / t / 00-testcritic.t
blobfa0fcc3a820fc8cfd80501e17c6a3fb83e974c85
1 #!/usr/bin/env perl
2 use strict;
3 use warnings;
5 # This script can be used to run perlcritic on perl files in koha
6 # It calls its own custom perlcriticrc
7 # The script is purely optional requiring Test::Perl::Critic to be installed
8 # and the environment variable TEST_QA to be set
9 # At present only the directories in @dirs will pass the tests in 'Gentle' mode
11 use File::Spec;
12 use Test::More;
13 use English qw(-no_match_vars);
15 my @all_koha_dirs = qw( acqui admin authorities basket C4 catalogue cataloguing circ course_reserves debian errors
16 labels members misc offline_circ opac patroncards patron_lists reports reserve reviews rotating_collections
17 serials sms suggestion t tags test tools virtualshelves Koha);
19 my @dirs = qw( acqui admin authorities basket catalogue cataloguing circ debian errors labels
20 members offline_circ reserve reviews rotating_collections serials sms virtualshelves Koha C4/SIP);
22 if ( not $ENV{TEST_QA} ) {
23 my $msg = 'Author test. Set $ENV{TEST_QA} to a true value to run';
24 plan( skip_all => $msg );
27 eval { require Test::Perl::Critic; };
29 if ( $EVAL_ERROR ) {
30 my $msg = 'Test::Perl::Critic required to criticise code,';
31 plan( skip_all => $msg );
34 my $rcfile = File::Spec->catfile( 't', 'perlcriticrc' );
35 Test::Perl::Critic->import( -profile => $rcfile);
36 all_critic_ok(@dirs);