From fcfdd133a96a339b3e60cef0364743b9d98fdbe9 Mon Sep 17 00:00:00 2001
From: Mason James <mtj@kohaaloha.com>
Date: Thu, 20 Oct 2022 13:26:17 +1300
Subject: [PATCH] =?UTF-8?q?Bug=C2=A031883:=20t::lib::QA::TemplateFilters?=
 =?UTF-8?q?=20missing=20built-in=20TT=20filter=20"trim"=20causes=20false?=
 =?UTF-8?q?=20warnings?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Content-Type: text/plain; charset="utf-8"

to test...

    1/ checkout latest master

    2/ prove xt/find-missing-filters.t
    xt/find-missing-filters.t .. 1/1
    #   Failed test 'Template variables should be correctly escaped'
    #   at xt/find-missing-filters.t line 59.
    #          got: '1'
    #     expected: '0'
    # $VAR1 = {
    #           'errors' => [
    #                         {
    #                           'error' => 'missing_filter',
    #                           'line' => '                        [% messages = INCLUDE \'patron_messages.inc\' moremember = 1 | trim %]',
    #                           'line_number' => 97
    #                         }
    #                       ],
    #           'file' => 'koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt'
    #         };
    # Looks like you failed 1 test of 1.

    3/ apply patch

    4/ prove xt/find-missing-filters.t

    xt/find-missing-filters.t .. ok
    All tests successful.
    Files=1, Tests=1,  2 wallclock secs ( 0.03 usr  0.01 sys +  2.15 cusr  0.07 csys =  2.26 CPU)
    Result: PASS <<<<<<<<<<<<<<<
---
 t/lib/QA/TemplateFilters.pm | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/t/lib/QA/TemplateFilters.pm b/t/lib/QA/TemplateFilters.pm
index 5df4fd814b..cc8c07bd79 100644
--- a/t/lib/QA/TemplateFilters.pm
+++ b/t/lib/QA/TemplateFilters.pm
@@ -157,6 +157,9 @@ sub process_tt_block {
         # Already has url or uri filter
         or $tt_block =~ m{\|\s?ur(l|i)}
 
+        # Already has trim filter
+        or $tt_block =~ m{\|\s?trim}
+
         # Specific for [% foo UNLESS bar %]
         or $tt_block =~ m{^(?<before>\S+)\s+UNLESS\s+(?<after>\S+)}
     ;
-- 
2.20.1