From 450fb0c34aa24e68e81699470cd4db3711f932a1 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 99e17af..c00f328 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 bdcfb96..755e98b 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 => 15; +use Test::More tests => 16; use Test::Warn; use MARC::Record; @@ -279,3 +279,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