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: Owen Leonard <oleonard@myacpl.org> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
This commit is contained in:
parent
c933244fe6
commit
2e92525848
3 changed files with 16 additions and 16 deletions
|
@ -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" )
|
||||
|
|
Loading…
Reference in a new issue