From aba498c20cebd6b7484a3cc8fc80dcdf1dbfb236 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 21 Jul 2020 09:47:11 +0200 Subject: [PATCH] Bug 22844: Fix yaml_valid.t - don't pick .json files Only .pref are considered yaml files. kohadev-koha@kohadevbox:/kohadevbox/koha$ time prove xt/yaml_valid.t xt/yaml_valid.t .. 1/19 # Failed test 'borrowers.json is YAML' # at xt/yaml_valid.t line 39. # Failed test 'items.json is YAML' # at xt/yaml_valid.t line 39. # Looks like you failed 2 tests of 19. --- xt/yaml_valid.t | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/xt/yaml_valid.t b/xt/yaml_valid.t index 4f38321802..b6f3c600d8 100755 --- a/xt/yaml_valid.t +++ b/xt/yaml_valid.t @@ -19,7 +19,7 @@ use Modern::Perl; use Test::YAML::Valid; -use Data::Dumper; +use File::Find; use Test::More; @@ -30,13 +30,19 @@ BEGIN { my $filebase = "$FindBin::Bin/../koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences"; -my @files = `ls -1 $filebase`; +my @files; +sub wanted { + my $name = $File::Find::name; + push @files, $name + if $name =~ /\.pref/; +} +find({ wanted => \&wanted, no_chdir => 1 }, $filebase); plan tests => scalar @files; foreach my $f (@files) { chomp $f; - yaml_file_ok( "$filebase/$f", "$f is YAML" ); + yaml_file_ok( $f, "$f is YAML" ); } -- 2.20.1