Commit 2e925258 authored by joubu's avatar joubu Committed by Wm. Nick Clemens

Bug 21576: Keep compatibility with QA script

The QA script call 'missing_filters', it sounds better to keep it in
order to avoid fixing it and have a weird condition (if
module->can('subroutine_name')) to maintain
Signed-off-by: default avatarOwen Leonard <oleonard@myacpl.org>
Signed-off-by: Martin Renvoize's avatarMartin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Wm. Nick Clemens's avatarNick Clemens <nick@bywatersolutions.com>
parent c933244f
......@@ -31,8 +31,8 @@ sub fix_filters {
return _process_tt_content( @_ )->{new_content};
}
sub search_missing_filters {
return _process_tt_content( @_ )->{errors};
sub missing_filters {
return @{_process_tt_content( @_ )->{errors}};
}
......@@ -217,7 +217,7 @@ t::lib::QA::TemplateFilters - Module used by tests and QA script to catch missin
my $content = read_file($filename);
my $new_content = t::lib::QA::TemplateFilters::fix_filters($content);
my $errors = t::lib::QA::TemplateFilters::search_missing_filters($content);
my $errors = t::lib::QA::TemplateFilters::missing_filters($content);
=head1 DESCRIPTION
......@@ -232,7 +232,7 @@ and to not duplicate the code.
the correct (guessed) filters.
It will also add the [% USE raw %] statement if it is needed.
=head2 search_missing_filters
=head2 missing_filters
Take a template content file in parameter and return an arrayref of errors.
......
......@@ -33,9 +33,9 @@ EXPECTED
my $new_content = t::lib::QA::TemplateFilters::fix_filters($input);
is( $new_content . "\n", $expected, );
my $missing_filters = t::lib::QA::TemplateFilters::search_missing_filters($input);
my @missing_filters = t::lib::QA::TemplateFilters::missing_filters($input);
is_deeply(
$missing_filters,
\@missing_filters,
[
{
error => "asset_must_be_raw",
......@@ -79,9 +79,9 @@ EXPECTED
my $new_content = t::lib::QA::TemplateFilters::fix_filters($input);
is( $new_content . "\n", $expected, );
my $missing_filters = t::lib::QA::TemplateFilters::search_missing_filters($input);
my @missing_filters = t::lib::QA::TemplateFilters::missing_filters($input);
is_deeply(
$missing_filters,
\@missing_filters,
[{
error => "missing_filter",
line => " [% just_a_var %]",
......@@ -163,9 +163,9 @@ EXPECTED
my $new_content = t::lib::QA::TemplateFilters::fix_filters($input);
is( $new_content . "\n", $expected, );
my $missing_filters = t::lib::QA::TemplateFilters::search_missing_filters($input);
my @missing_filters = t::lib::QA::TemplateFilters::missing_filters($input);
is_deeply(
$missing_filters,[],);
\@missing_filters,[],);
};
subtest 'Preserve pre/post chomps' => sub {
......@@ -228,9 +228,9 @@ EXPECTED
$input = <<INPUT;
<a href="[% wrong_filter | html %]">[% var | html %]</a>
INPUT
my $missing_filters = t::lib::QA::TemplateFilters::search_missing_filters($input);
my @missing_filters = t::lib::QA::TemplateFilters::missing_filters($input);
is_deeply(
$missing_filters,
\@missing_filters,
[
{
error => "wrong_html_filter",
......@@ -245,6 +245,6 @@ INPUT
$input = <<INPUT;
<a href="[% good_raw_filter | \$raw %]">[% var | html %]</a>
INPUT
$missing_filters = t::lib::QA::TemplateFilters::search_missing_filters($input);
is_deeply( $missing_filters, [], );
@missing_filters = t::lib::QA::TemplateFilters::missing_filters($input);
is_deeply( \@missing_filters, [], );
};
......@@ -52,8 +52,8 @@ find({ wanted => \&wanted, no_chdir => 1 }, @themes );
my @errors;
for my $file ( @files ) {
my $content = read_file($file);
my $e = t::lib::QA::TemplateFilters::search_missing_filters($content);
push @errors, { file => $file, errors => $e } if @$e;
my @e = t::lib::QA::TemplateFilters::missing_filters($content);
push @errors, { file => $file, errors => \@e } if @e;
}
is( @errors, 0, "Template variables should be correctly escaped" )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment