From e0165b70b2d6d8c5d60d8f548bc14a7273ae8115 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Fri, 12 Mar 2021 13:50:14 +0000 Subject: [PATCH] Bug 26734: (QA follow-up) Unit tests for C4::Letters Content-Type: text/plain; charset=utf-8 This patch adds unit tests for the addition of 'include handling' to the C4::Letters template toolkit functionality. Test plan 1/ Run t/db_dependant/Letters/TemplateToolkit.t Signed-off-by: Marcel de Rooy --- t/db_dependent/Letters/TemplateToolkit.t | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/t/db_dependent/Letters/TemplateToolkit.t b/t/db_dependent/Letters/TemplateToolkit.t index 2489ebe35c..8d049423c6 100755 --- a/t/db_dependent/Letters/TemplateToolkit.t +++ b/t/db_dependent/Letters/TemplateToolkit.t @@ -19,7 +19,7 @@ # along with Koha; if not, see . use Modern::Perl; -use Test::More tests => 27; +use Test::More tests => 28; use Test::MockModule; use Test::Warn; @@ -1082,6 +1082,28 @@ subtest 'add_tt_filters' => sub { is( $letter->{content}, $expected_letter, "Pre-processing should call TT plugin to remove punctuation if table is biblio or biblioitems"); }; +subtest 'Handle includes' => sub { + plan tests => 1; + my $cgi = CGI->new(); + my $code = 'TEST_INCLUDE'; + my $account = + $builder->build_object( { class => 'Koha::Account::Lines', value => { credit_type_code => 'PAYMENT', status => 'CANCELLED' } } ); + my $template = < $template, code => $code, module => 'test' }); + my $letter = GetPreparedLetter( + module => 'test', + letter_code => $code, + tables => { + credits => $account->accountlines_id + } + ); + is($letter->{content},' Payment (Cancelled) ', "Include used in notice"); +}; + subtest 'Dates formatting' => sub { plan tests => 1; my $code = 'TEST_DATE'; -- 2.11.0