From 80542dfa4f0b85818524730322aeab72360050d8 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Fri, 18 Jul 2025 14:13:21 +0200 Subject: [PATCH] Bug 40444: Add Test::NoWarnings to xt tests --- xt/author/Text_CSV_Various.t | 3 ++- xt/author/codespell.t | 3 ++- xt/author/icondirectories.t | 3 ++- xt/check_makefile.t | 4 ++-- xt/find-misplaced-executables.t | 3 ++- xt/find-missing-auth_checks.t | 4 ++-- xt/find-missing-csrf.t | 3 ++- xt/find-missing-filters.t | 3 ++- xt/find-missing-op-in-forms.t | 3 ++- xt/js_tidy.t | 3 ++- xt/perltidy.t | 3 ++- xt/single_quotes.t | 3 ++- xt/use-test-no-warnings.t | 11 ++++++++++- xt/verify-debian-docbook.t | 5 ++++- xt/verify-yarnlock.t | 3 ++- xt/verify_bib1.att.t | 3 ++- xt/vue_tidy.t | 3 ++- xt/yaml_valid.t | 3 ++- 18 files changed, 46 insertions(+), 20 deletions(-) diff --git a/xt/author/Text_CSV_Various.t b/xt/author/Text_CSV_Various.t index 768dffb6445..5521493ca99 100755 --- a/xt/author/Text_CSV_Various.t +++ b/xt/author/Text_CSV_Various.t @@ -24,7 +24,8 @@ use Modern::Perl; use open OUT => ':encoding(UTF-8)', ':std'; use utf8; -use Test::More tests => 21; +use Test::More tests => 22; +use Test::NoWarnings; use Text::CSV; use Text::CSV_XS; diff --git a/xt/author/codespell.t b/xt/author/codespell.t index e31799ca517..9c81eca433c 100755 --- a/xt/author/codespell.t +++ b/xt/author/codespell.t @@ -2,6 +2,7 @@ use Modern::Perl; use Test::PerlTidy; use Test::More; +use Test::NoWarnings; use Koha::Devel::Files; @@ -17,7 +18,7 @@ push @files, $dev_files->ls_perl_files; push @files, $dev_files->ls_tt_files; push @files, $dev_files->ls_js_files; -plan tests => scalar @files; +plan tests => scalar(@files) + 1; for my $file (@files) { my $output = qx{codespell -d --ignore-words .codespell-ignore $file}; diff --git a/xt/author/icondirectories.t b/xt/author/icondirectories.t index 64fb7156c09..b1e5f37accb 100755 --- a/xt/author/icondirectories.t +++ b/xt/author/icondirectories.t @@ -34,7 +34,8 @@ use lib qw( .. ); use Data::Dumper; use File::Find; -use Test::More tests => 3; +use Test::More tests => 4; +use Test::NoWarnings; # hardcoded OPAC & STAFF dirs my $opac_dir = 'koha-tmpl/opac-tmpl'; diff --git a/xt/check_makefile.t b/xt/check_makefile.t index bbdb4ccb3e0..ca156fc59ea 100755 --- a/xt/check_makefile.t +++ b/xt/check_makefile.t @@ -18,8 +18,8 @@ # along with Koha; if not, see . use Modern::Perl; -use Test::More; -plan tests => 2; +use Test::More tests => 3; +use Test::NoWarnings; use File::Spec; use File::Slurp qw( read_file ); diff --git a/xt/find-misplaced-executables.t b/xt/find-misplaced-executables.t index f0cc340ecae..860792d14a9 100755 --- a/xt/find-misplaced-executables.t +++ b/xt/find-misplaced-executables.t @@ -23,7 +23,8 @@ use Modern::Perl; use File::Find; use Data::Dumper; -use Test::More tests => 1; +use Test::More tests => 2; +use Test::NoWarnings; my @files; diff --git a/xt/find-missing-auth_checks.t b/xt/find-missing-auth_checks.t index a1a5c0d594d..97a5f409496 100755 --- a/xt/find-missing-auth_checks.t +++ b/xt/find-missing-auth_checks.t @@ -16,7 +16,8 @@ # along with Koha; if not, see . use Modern::Perl; -use Test::More; +use Test::More tests => 2; +use Test::NoWarnings; use File::Slurp qw(read_file); @@ -39,4 +40,3 @@ FILE: foreach my $file (@files) { push @missing_auth_check, $file; } is( scalar @missing_auth_check, 0 ) or diag "No auth check in the following files:\n" . join "\n", @missing_auth_check; -done_testing; diff --git a/xt/find-missing-csrf.t b/xt/find-missing-csrf.t index 59610f9d284..761cf784e35 100755 --- a/xt/find-missing-csrf.t +++ b/xt/find-missing-csrf.t @@ -18,7 +18,8 @@ # along with Koha; if not, see . use Modern::Perl; -use Test::More tests => 2; +use Test::More tests => 3; +use Test::NoWarnings; use File::Slurp; use Data::Dumper; diff --git a/xt/find-missing-filters.t b/xt/find-missing-filters.t index 425c73921e1..b12cb159484 100755 --- a/xt/find-missing-filters.t +++ b/xt/find-missing-filters.t @@ -16,7 +16,8 @@ # along with Koha; if not, see . use Modern::Perl; -use Test::More tests => 2; +use Test::More tests => 3; +use Test::NoWarnings; use File::Slurp qw( read_file ); use Data::Dumper; use t::lib::QA::TemplateFilters; diff --git a/xt/find-missing-op-in-forms.t b/xt/find-missing-op-in-forms.t index 7699bfafcff..eb2fd4d92b6 100755 --- a/xt/find-missing-op-in-forms.t +++ b/xt/find-missing-op-in-forms.t @@ -18,7 +18,8 @@ # along with Koha; if not, see . use Modern::Perl; -use Test::More tests => 2; +use Test::More tests => 3; +use Test::NoWarnings; use File::Slurp; use Data::Dumper; diff --git a/xt/js_tidy.t b/xt/js_tidy.t index 940f2b622c5..2e1cb330aac 100755 --- a/xt/js_tidy.t +++ b/xt/js_tidy.t @@ -18,10 +18,11 @@ use Modern::Perl; use File::Slurp qw( read_file ); use Test::More; +use Test::NoWarnings; my @js_files = qx{git ls-files '*.js' '*.ts'}; -plan tests => scalar @js_files; +plan tests => scalar(@js_files) + 1; foreach my $filepath (@js_files) { chomp $filepath; diff --git a/xt/perltidy.t b/xt/perltidy.t index edf8a5abd3e..244c9818140 100755 --- a/xt/perltidy.t +++ b/xt/perltidy.t @@ -2,13 +2,14 @@ use Modern::Perl; use Test::PerlTidy; use Test::More; +use Test::NoWarnings; use Koha::Devel::Files; my $dev_files = Koha::Devel::Files->new( { context => 'tidy' } ); my @files = $dev_files->ls_perl_files; -plan tests => scalar @files; +plan tests => scalar(@files) + 1; for my $file (@files) { ok( Test::PerlTidy::is_file_tidy($file) ); diff --git a/xt/single_quotes.t b/xt/single_quotes.t index a0e7413f9bb..f90aa835a27 100755 --- a/xt/single_quotes.t +++ b/xt/single_quotes.t @@ -18,7 +18,8 @@ # along with Koha; if not, see . use Modern::Perl; -use Test::More tests => 2; +use Test::More tests => 3; +use Test::NoWarnings; use File::Slurp qw( read_file ); use Koha::Devel::Files; diff --git a/xt/use-test-no-warnings.t b/xt/use-test-no-warnings.t index c7ab9e6ca75..35443992dc8 100755 --- a/xt/use-test-no-warnings.t +++ b/xt/use-test-no-warnings.t @@ -21,7 +21,7 @@ use Test::NoWarnings; use Array::Utils qw( array_minus ); -my @t_files = qx{git grep --files-without-match "Test::NoWarnings" 't/*.t'}; +my @t_files = qx{git grep --files-without-match "Test::NoWarnings" 't/*.t' 'xt/*.t'}; chomp for @t_files; my @exceptions = ( @@ -46,6 +46,15 @@ my @exceptions = ( # bug 40443 "t/db_dependent/cronjobs/advance_notices_digest.t", + + # Cannot be removed + "xt/author/podcorrectness.t", + + # bug 40449 + "xt/author/valid-templates.t", + + # bug 40315 + "xt/tt_tidy.t", ); @t_files = array_minus( @t_files, @exceptions ); diff --git a/xt/verify-debian-docbook.t b/xt/verify-debian-docbook.t index db6e85e4693..7471b809715 100755 --- a/xt/verify-debian-docbook.t +++ b/xt/verify-debian-docbook.t @@ -21,12 +21,15 @@ # generates the koha-common man pages and ensures they're correct. use Modern::Perl; -use Test::More qw(no_plan); +use Test::More; +use Test::NoWarnings; my $doc_dir = 'debian/docs'; my @doc_files = glob( $doc_dir . '/*.xml' ); my @command = qw(xmllint --noout); +plan tests => scalar(@doc_files) + 1; + foreach my $file (@doc_files) { ok( system( @command, $file ) == 0, "XML validation for $file" ); } diff --git a/xt/verify-yarnlock.t b/xt/verify-yarnlock.t index 088495c9d87..c83e03c26e5 100755 --- a/xt/verify-yarnlock.t +++ b/xt/verify-yarnlock.t @@ -23,7 +23,8 @@ # 'git commit ./yarn.lock'. use Modern::Perl; -use Test::More tests => 1; +use Test::More tests => 2; +use Test::NoWarnings; my $rc; diff --git a/xt/verify_bib1.att.t b/xt/verify_bib1.att.t index c9ad13117a0..cfa1b5689ef 100755 --- a/xt/verify_bib1.att.t +++ b/xt/verify_bib1.att.t @@ -17,7 +17,8 @@ use Modern::Perl; -use Test::More tests => 2; +use Test::More tests => 3; +use Test::NoWarnings; foreach my $record_type (qw( biblios authorities )) { diff --git a/xt/vue_tidy.t b/xt/vue_tidy.t index 03ab5033088..8b8685bb69a 100755 --- a/xt/vue_tidy.t +++ b/xt/vue_tidy.t @@ -18,10 +18,11 @@ use Modern::Perl; use File::Slurp qw( read_file ); use Test::More; +use Test::NoWarnings; my @vue_files = `git ls-files 'koha-tmpl/intranet-tmpl/prog/js/vue/*.vue'`; -plan tests => scalar @vue_files; +plan tests => scalar(@vue_files) + 1; foreach my $filepath (@vue_files) { chomp $filepath; diff --git a/xt/yaml_valid.t b/xt/yaml_valid.t index f8a0c1cca95..4d8c2d34089 100755 --- a/xt/yaml_valid.t +++ b/xt/yaml_valid.t @@ -23,6 +23,7 @@ use File::Find; use FindBin (); use Test::More; +use Test::NoWarnings; my $filebase = "$FindBin::Bin/../koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences"; @@ -35,7 +36,7 @@ sub wanted { } find( { wanted => \&wanted, no_chdir => 1 }, $filebase ); -plan tests => scalar @files; +plan tests => scalar(@files) + 1; foreach my $f (@files) { chomp $f; -- 2.34.1