Bugzilla – Attachment 80695 Details for
Bug 21576
Add a developer script to automatically fix missing filters
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 21576: Keep compatibility with QA script
Bug-21576-Keep-compatibility-with-QA-script.patch (text/plain), 4.75 KB, created by
Martin Renvoize (ashimema)
on 2018-10-17 11:27:03 UTC
(
hide
)
Description:
Bug 21576: Keep compatibility with QA script
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2018-10-17 11:27:03 UTC
Size:
4.75 KB
patch
obsolete
>From 260f5c21a817e9e087480adca67ed7480fdfc00c Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Mon, 15 Oct 2018 17:29:35 -0300 >Subject: [PATCH] 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> >--- > t/lib/QA/TemplateFilters.pm | 8 ++++---- > t/template_filters.t | 20 ++++++++++---------- > xt/find-missing-filters.t | 4 ++-- > 3 files changed, 16 insertions(+), 16 deletions(-) > >diff --git a/t/lib/QA/TemplateFilters.pm b/t/lib/QA/TemplateFilters.pm >index 400de8bf70..8e817ce013 100644 >--- a/t/lib/QA/TemplateFilters.pm >+++ b/t/lib/QA/TemplateFilters.pm >@@ -30,8 +30,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}}; > > } > >@@ -216,7 +216,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 > >@@ -231,7 +231,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. > >diff --git a/t/template_filters.t b/t/template_filters.t >index 3c9c5a97a3..96547a3cd2 100644 >--- a/t/template_filters.t >+++ b/t/template_filters.t >@@ -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, [], ); > }; >diff --git a/xt/find-missing-filters.t b/xt/find-missing-filters.t >index 858c8362f2..6b7e80f4aa 100755 >--- a/xt/find-missing-filters.t >+++ b/xt/find-missing-filters.t >@@ -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" ) >-- >2.19.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 21576
:
80640
|
80642
|
80644
|
80648
|
80659
|
80660
|
80671
|
80672
|
80673
|
80694
|
80695
|
80696
|
80716
|
81060
|
81061
|
81062
|
81063