Bugzilla – Attachment 79237 Details for
Bug 21393
Make template filter checks code reusable
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 21393: Add tests
Bug-21393-Add-tests.patch (text/plain), 4.22 KB, created by
Jonathan Druart
on 2018-09-21 16:15:24 UTC
(
hide
)
Description:
Bug 21393: Add tests
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2018-09-21 16:15:24 UTC
Size:
4.22 KB
patch
obsolete
>From 799fe7b8a132c2a33c9320e8cfde9dc4f876fab1 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Fri, 21 Sep 2018 12:03:05 -0300 >Subject: [PATCH] Bug 21393: Add tests > >--- > t/template_filters.t | 118 +++++++++++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 118 insertions(+) > create mode 100644 t/template_filters.t > >diff --git a/t/template_filters.t b/t/template_filters.t >new file mode 100644 >index 0000000000..4131534838 >--- /dev/null >+++ b/t/template_filters.t >@@ -0,0 +1,118 @@ >+# Copyright 2018 Koha Development Team >+# >+# This file is part of Koha. >+# >+# Koha is free software; you can redistribute it and/or modify it >+# under the terms of the GNU General Public License as published by >+# the Free Software Foundation; either version 3 of the License, or >+# (at your option) any later version. >+# >+# Koha is distributed in the hope that it will be useful, but >+# WITHOUT ANY WARRANTY; without even the implied warranty of >+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >+# GNU General Public License for more details. >+# >+# You should have received a copy of the GNU General Public License >+# along with Koha; if not, see <http://www.gnu.org/licenses>. >+ >+use Modern::Perl; >+use Test::More tests => 1; >+use t::lib::QA::TemplateFilters; >+ >+my $input = <<INPUT; >+[% USE Asset %] >+[% INCLUDE 'doc-head-open.inc' %] >+<title>Koha › Patrons › >+ [% UNLESS blocking_error %] >+ Patron details for [% INCLUDE 'patron-title.inc' no_html = 1 %] >+ [% just_a_var %] A N D [% another_one_on_same_line %] >+ [% just_a_var_filtered|html %] >+ [% just_a_var_filtered |html %] >+ [% just_a_var_filtered| html %] >+ [% just_a_var_filtered | html %] >+ [% END %] >+ [% IF ( patron.othernames | html ) %]“[% patron.othernames %]”[% END %] >+ [% Asset.css("css/datatables.css").raw %] >+ [% Asset.css("css/datatables.css") | \$raw %] >+</title> >+<a href="tel:[% patron.phone %]">[% patron.phone %]</a> >+<a title="[% patron.emailpro %]" href="mailto:[% patron.emailpro | uri %]">[% patron.emailpro %]</a> >+[% patron_message.get_column('manager_surname') %] >+[%# do_nothing %] >+[% # do_nothing %] >+[% SWITCH var %] >+[% CASE 'foo' %]foo >+[% CASE %] >+[% END %] >+[%- SWITCH var -%] >+[%- CASE 'foo' -%]foo >+[%- CASE -%] >+[%- END -%] >+[%- var -%] >+[% - var - %] >+[%~ var ~%] >+[% ~ var ~ %] >+[% var | \$raw %] >+[% foo UNLESS bar %] >+[% SET var = val %] >+[% var = val %] >+[%END%] >+INPUT >+ >+my @expected_errors = ( >+ { >+ error => q{missing_filter}, >+ line => q{ [% just_a_var %] A N D [% another_one_on_same_line %]}, >+ }, >+ { >+ error => q{missing_filter}, >+ line => q{ [% just_a_var %] A N D [% another_one_on_same_line %]}, >+ }, >+ { >+ error => q{missing_filter}, >+ line => q{ [% IF ( patron.othernames | html ) %]“[% patron.othernames %]”[% END %]}, >+ }, >+ { >+ error => q{asset_must_be_raw}, >+ line => q{ [% Asset.css("css/datatables.css").raw %]}, >+ }, >+ { >+ error => q{missing_filter}, >+ line => q{<a href="tel:[% patron.phone %]">[% patron.phone %]</a>}, >+ }, >+ { >+ error => q{missing_filter}, >+ line => q{<a href="tel:[% patron.phone %]">[% patron.phone %]</a>}, >+ }, >+ { >+ error => q{missing_filter}, >+ line => q{<a title="[% patron.emailpro %]" href="mailto:[% patron.emailpro | uri %]">[% patron.emailpro %]</a>}, >+ }, >+ { >+ error => q{missing_filter}, >+ line => q{<a title="[% patron.emailpro %]" href="mailto:[% patron.emailpro | uri %]">[% patron.emailpro %]</a>}, >+ }, >+ { >+ error => q{missing_filter}, >+ line => q{[% patron_message.get_column('manager_surname') %]}, >+ }, >+ { >+ error => q{missing_filter}, >+ line => q{[%- var -%]}, >+ }, >+ { >+ error => q{missing_filter}, >+ line => q{[% - var - %]}, >+ }, >+ { >+ error => q{missing_filter}, >+ line => q{[%~ var ~%]}, >+ }, >+ { >+ error => q{missing_filter}, >+ line => q{[% ~ var ~ %]}, >+ } >+); >+ >+my @get = t::lib::QA::TemplateFilters::missing_filters($input); >+is_deeply( \@get, \@expected_errors); >-- >2.11.0
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 21393
:
79236
|
79237
|
79238
|
79281
|
79282
|
79283
|
79535
|
79536
|
79537