From 133802332bbc4a7ea53fe8b905e96a9189925297 Mon Sep 17 00:00:00 2001 From: Julian Maurice Date: Wed, 3 Jul 2024 15:14:27 +0200 Subject: [PATCH] Bug 37245: Modify 00-strict.t to check all Perl files and minor changes to Koha::Localization and Koha::MarcOverlayRules to make tests pass Test plan: - Run `prove t/db_dependent/00-strict.t` - Wait... (it took ~5 minutes for me) - Should be green at the end Signed-off-by: David Nind --- Koha/Localization.pm | 1 + Koha/MarcOverlayRules.pm | 3 ++- t/db_dependent/00-strict.t | 34 +++++++--------------------------- 3 files changed, 10 insertions(+), 28 deletions(-) diff --git a/Koha/Localization.pm b/Koha/Localization.pm index 90201b8870..7e91d76a11 100644 --- a/Koha/Localization.pm +++ b/Koha/Localization.pm @@ -18,6 +18,7 @@ package Koha::Localization; use Modern::Perl; use Koha::Database; +use Koha::Caches; use base qw(Koha::Object); diff --git a/Koha/MarcOverlayRules.pm b/Koha/MarcOverlayRules.pm index b874f7cd07..99af52f1de 100644 --- a/Koha/MarcOverlayRules.pm +++ b/Koha/MarcOverlayRules.pm @@ -17,9 +17,10 @@ package Koha::MarcOverlayRules; use Modern::Perl; use List::Util qw(first); -use Koha::MarcOverlayRule; use Carp; +use Koha::Caches; +use Koha::MarcOverlayRule; use Koha::Exceptions::MarcOverlayRule; use Try::Tiny; use Scalar::Util qw(looks_like_number); diff --git a/t/db_dependent/00-strict.t b/t/db_dependent/00-strict.t index 41515a9451..f7030b4335 100755 --- a/t/db_dependent/00-strict.t +++ b/t/db_dependent/00-strict.t @@ -11,29 +11,11 @@ use Parallel::ForkManager; use Sys::CPU; use lib("misc/translator"); -use lib("installer"); - -my @dirs = ( - 'acqui', 'admin', - 'authorities', 'basket', - 'catalogue', 'cataloguing', - 'changelanguage.pl', 'circ', - 'debian', 'docs', - 'errors', 'fix-perl-path.PL', 'help.pl', - 'installer', 'kohaversion.pl', 'labels', - 'mainpage.pl', 'Makefile.PL', - 'members', 'misc', - 'offline_circ', 'opac', - 'patroncards', 'reports', - 'reserve', 'reviews', - 'rewrite-config.PL', 'rotating_collections', - 'serials', 'services', - 'skel', 'suggestion', - 'svc', 'tags', - 'tools', 'virtualshelves' -); - -$Test::Strict::TEST_STRICT = 0; + +my @files = `git ls-files '*.pl' '*.PL' '*.pm' '*.psgi'`; +chomp(@files); + +plan tests => scalar @files; my $ncpu; if ( $ENV{KOHA_PROVE_CPUS} ) { @@ -44,14 +26,12 @@ if ( $ENV{KOHA_PROVE_CPUS} ) { my $pm = Parallel::ForkManager->new($ncpu); -foreach my $d (@dirs) { +foreach my $file (@files) { $pm->start and next; # do the fork - all_perl_files_ok($d); + syntax_ok($file); $pm->finish; # do the exit in the child process } $pm->wait_all_children; - -done_testing(); -- 2.39.2