View | Details | Raw Unified | Return to bug 33743
Collapse All | Expand All

(-)a/xt/find-missing-filters.t (-26 / +9 lines)
Lines 17-56 Link Here
17
17
18
use Modern::Perl;
18
use Modern::Perl;
19
use Test::More tests => 1;
19
use Test::More tests => 1;
20
use File::Find;
20
use File::Slurp qw( read_file );
21
use File::Slurp;
22
use Data::Dumper;
21
use Data::Dumper;
23
use t::lib::QA::TemplateFilters;
22
use t::lib::QA::TemplateFilters;
24
23
25
my @themes;
26
27
# OPAC themes
28
my $opac_dir  = 'koha-tmpl/opac-tmpl';
29
opendir ( my $dh, $opac_dir ) or die "can't opendir $opac_dir: $!";
30
for my $theme ( grep { not /^\.|lib|js|xslt/ } readdir($dh) ) {
31
    push @themes, "$opac_dir/$theme/en";
32
}
33
close $dh;
34
35
# STAFF themes
36
my $staff_dir = 'koha-tmpl/intranet-tmpl';
37
opendir ( $dh, $staff_dir ) or die "can't opendir $staff_dir: $!";
38
for my $theme ( grep { not /^\.|lib|js/ } readdir($dh) ) {
39
    push @themes, "$staff_dir/$theme/en";
40
}
41
close $dh;
42
43
my @files;
24
my @files;
44
sub wanted {
45
    my $name = $File::Find::name;
46
    push @files, $name
47
        if $name =~ m[\.(tt|inc)$] and -f $name;
48
}
49
25
50
find({ wanted => \&wanted, no_chdir => 1 }, @themes );
26
# OPAC
27
push @files, `git ls-files 'koha-tmpl/opac-tmpl/bootstrap/en/*.tt'`;
28
push @files, `git ls-files 'koha-tmpl/opac-tmpl/bootstrap/en/*.inc'`;
29
30
# Staff
31
push @files, `git ls-files 'koha-tmpl/intranet-tmpl/prog/en/*.tt'`;
32
push @files, `git ls-files 'koha-tmpl/intranet-tmpl/prog/en/*.inc'`;
51
33
52
my @errors;
34
my @errors;
53
for my $file ( @files ) {
35
for my $file ( @files ) {
36
    chomp $file;
54
    my $content = read_file($file);
37
    my $content = read_file($file);
55
    my @e = t::lib::QA::TemplateFilters::missing_filters($content);
38
    my @e = t::lib::QA::TemplateFilters::missing_filters($content);
56
    push @errors, { file => $file, errors => \@e } if @e;
39
    push @errors, { file => $file, errors => \@e } if @e;
(-)a/xt/single_quotes.t (-28 / +16 lines)
Lines 19-57 Link Here
19
19
20
use Modern::Perl;
20
use Modern::Perl;
21
use Test::More tests => 1;
21
use Test::More tests => 1;
22
use File::Find;
22
use File::Slurp qw( read_file );
23
23
24
my @themes;
24
my @files;
25
25
26
# OPAC themes
26
# OPAC
27
my $opac_dir  = 'koha-tmpl/opac-tmpl';
27
push @files, `git ls-files 'koha-tmpl/opac-tmpl/bootstrap/en/*.tt'`;
28
opendir ( my $dh, $opac_dir ) or die "can't opendir $opac_dir: $!";
28
push @files, `git ls-files 'koha-tmpl/opac-tmpl/bootstrap/en/*.inc'`;
29
for my $theme ( grep { not /^\.|lib|js|xslt/ } readdir($dh) ) {
30
    push @themes, "$opac_dir/$theme/en";
31
}
32
close $dh;
33
29
34
# STAFF themes
30
# Staff
35
my $staff_dir = 'koha-tmpl/intranet-tmpl';
31
push @files, `git ls-files 'koha-tmpl/intranet-tmpl/prog/en/*.tt'`;
36
opendir ( $dh, $staff_dir ) or die "can't opendir $staff_dir: $!";
32
push @files, `git ls-files 'koha-tmpl/intranet-tmpl/prog/en/*.inc'`;
37
for my $theme ( grep { not /^\.|lib|js/ } readdir($dh) ) {
38
    push @themes, "$staff_dir/$theme/en";
39
}
40
close $dh;
41
33
42
my @files;
34
my @errors;
43
find(
35
for my $file ( @files ) {
44
    sub {
36
    chomp $file;
45
        open my $fh, '<', $_ or die "Could not open $_: $!";
37
    my @lines = sort grep /\_\(\'/, read_file($file);
46
        my @lines = sort grep /\_\(\'/, <$fh>;
38
    push @errors, { name => $file, lines => \@lines } if @lines;
47
        push @files, { name => "$_", lines => \@lines } if @lines;
39
}
48
    },
49
    @themes
50
);
51
40
52
ok( !@files, "Files do not contain single quotes _(' " )
41
ok( !@errors, "Files do not contain single quotes _(' " )
53
  or diag(
42
  or diag(
54
    "Files list: \n",
43
    "Files list: \n",
55
    join( "\n",
44
    join( "\n",
56
        map { $_->{name} . ': ' . join( ', ', @{ $_->{lines} } ) } @files )
45
        map { $_->{name} . ': ' . join( ', ', @{ $_->{lines} } ) } @errors )
57
  );
46
  );
58
- 

Return to bug 33743