From e0fea9f5f814104f90868bf8de060c6e0b0af4b7 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Fri, 2 Dec 2016 15:52:10 +0000 Subject: [PATCH] Bug 15969 - Add unit test of substitution param --- C4/Letters.pm | 4 ++-- t/db_dependent/Letters/TemplateToolkit.t | 14 +++++++++++++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/C4/Letters.pm b/C4/Letters.pm index d5d93e2..eaecf36 100644 --- a/C4/Letters.pm +++ b/C4/Letters.pm @@ -768,8 +768,8 @@ sub GetPreparedLetter { $letter->{content} = _process_tt( { - content => $letter->{content}, - tables => $tables, + content => $letter->{content}, + tables => $tables, substitute => $substitute, } ); diff --git a/t/db_dependent/Letters/TemplateToolkit.t b/t/db_dependent/Letters/TemplateToolkit.t index 4169556..22384f6 100644 --- a/t/db_dependent/Letters/TemplateToolkit.t +++ b/t/db_dependent/Letters/TemplateToolkit.t @@ -18,7 +18,7 @@ # along with Koha; if not, see . use Modern::Perl; -use Test::More tests => 14; +use Test::More tests => 15; use MARC::Record; @@ -264,3 +264,15 @@ $prepared_letter = GetPreparedLetter( ) ); is( $prepared_letter->{content}, $modification->id(), 'Patron modification object used correctly' ); + +$sth->execute( "TEST_SUBSTITUTION", "[% SubstituteMe %]" ); +$prepared_letter = GetPreparedLetter( + ( + module => 'test', + letter_code => 'TEST_SUBSTITUTION', + substitute => { + SubstituteMe => 'Substituted' + } + ) +); +is( $prepared_letter->{content}, 'Substituted', 'Substitution works correctly' ); -- 2.1.4