Bug 36244: Unit test for tt syntax in parameters
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de> (cherry picked from commit 3f8b7785cd703f89de140108eb9347bf33a0c764) Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
parent
93a68d2068
commit
03e644cdea
1 changed files with 46 additions and 1 deletions
|
@ -18,7 +18,7 @@
|
||||||
# along with Koha; if not, see <http://www.gnu.org/licenses>.
|
# along with Koha; if not, see <http://www.gnu.org/licenses>.
|
||||||
|
|
||||||
use Modern::Perl;
|
use Modern::Perl;
|
||||||
use Test::More tests => 99;
|
use Test::More tests => 100;
|
||||||
use Test::MockModule;
|
use Test::MockModule;
|
||||||
use Test::Warn;
|
use Test::Warn;
|
||||||
use Test::Exception;
|
use Test::Exception;
|
||||||
|
@ -1410,3 +1410,48 @@ subtest 'Test message_id parameter for SendQueuedMessages' => sub {
|
||||||
is( $message_1->{status}, 'failed', 'Message 1 status is unchanged' );
|
is( $message_1->{status}, 'failed', 'Message 1 status is unchanged' );
|
||||||
is( $message_2->{status}, 'sent', 'Valid from_address => status sent' );
|
is( $message_2->{status}, 'sent', 'Valid from_address => status sent' );
|
||||||
};
|
};
|
||||||
|
|
||||||
|
subtest 'Template toolkit syntax in parameters' => sub {
|
||||||
|
|
||||||
|
my $borrowernumber = Koha::Patron->new(
|
||||||
|
{
|
||||||
|
firstname => 'Robert',
|
||||||
|
surname => '[% USE Categories %][% Categories.all().search_related("borrowers").count() %]',
|
||||||
|
categorycode => $patron_category,
|
||||||
|
branchcode => $library->{branchcode},
|
||||||
|
dateofbirth => $date,
|
||||||
|
smsalertnumber => undef,
|
||||||
|
}
|
||||||
|
)->store->borrowernumber;
|
||||||
|
|
||||||
|
my $title = q|<<branches.branchname>> - <<status>>|;
|
||||||
|
my $content = q{Dear <<borrowers.firstname>> <<borrowers.surname>>};
|
||||||
|
|
||||||
|
$dbh->do(
|
||||||
|
q|INSERT INTO letter(branchcode,module,code,name,is_html,title,content,message_transport_type) VALUES (?,'my module','tt test','my name',1,?,?,'email')|,
|
||||||
|
undef, $library->{branchcode}, $title, $content
|
||||||
|
);
|
||||||
|
|
||||||
|
my $tables = {
|
||||||
|
borrowers => $borrowernumber,
|
||||||
|
branches => $library->{branchcode},
|
||||||
|
biblio => $biblionumber,
|
||||||
|
};
|
||||||
|
my $substitute = {
|
||||||
|
status => 'overdue',
|
||||||
|
};
|
||||||
|
my $prepared_letter = GetPreparedLetter(
|
||||||
|
module => 'my module',
|
||||||
|
branchcode => $library->{branchcode},
|
||||||
|
letter_code => 'tt test',
|
||||||
|
tables => $tables,
|
||||||
|
substitute => $substitute,
|
||||||
|
repeat => [],
|
||||||
|
);
|
||||||
|
|
||||||
|
is(
|
||||||
|
$prepared_letter->{content},
|
||||||
|
'Dear Robert [% USE Categories %][% Categories.all().search_related("borrowers").count() %]',
|
||||||
|
'Template toolkit syntax in parameter was not evaluated.'
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
Loading…
Reference in a new issue