Lines 18-24
Link Here
|
18 |
# along with Koha; if not, see <http://www.gnu.org/licenses>. |
18 |
# along with Koha; if not, see <http://www.gnu.org/licenses>. |
19 |
|
19 |
|
20 |
use Modern::Perl; |
20 |
use Modern::Perl; |
21 |
use Test::More tests => 85; |
21 |
use Test::More tests => 86; |
22 |
use Test::MockModule; |
22 |
use Test::MockModule; |
23 |
use Test::Warn; |
23 |
use Test::Warn; |
24 |
use Test::Exception; |
24 |
use Test::Exception; |
Lines 995-997
subtest 'Test message_id parameter for SendQueuedMessages' => sub {
Link Here
|
995 |
is( $message_1->{status}, 'failed', 'Message 1 status is unchanged' ); |
995 |
is( $message_1->{status}, 'failed', 'Message 1 status is unchanged' ); |
996 |
is( $message_2->{status}, 'sent', 'Valid from_address => status sent' ); |
996 |
is( $message_2->{status}, 'sent', 'Valid from_address => status sent' ); |
997 |
}; |
997 |
}; |
998 |
- |
998 |
|
|
|
999 |
subtest 'Template toolkit syntax in parameters' => sub { |
1000 |
|
1001 |
my $borrowernumber = Koha::Patron->new( |
1002 |
{ |
1003 |
firstname => 'Robert', |
1004 |
surname => '[% USE Categories %][% Categories.all().search_related("borrowers").count() %]', |
1005 |
categorycode => $patron_category, |
1006 |
branchcode => $library->{branchcode}, |
1007 |
dateofbirth => $date, |
1008 |
smsalertnumber => undef, |
1009 |
} |
1010 |
)->store->borrowernumber; |
1011 |
|
1012 |
my $title = q|<<branches.branchname>> - <<status>>|; |
1013 |
my $content = q{Dear <<borrowers.firstname>> <<borrowers.surname>>}; |
1014 |
|
1015 |
$dbh->do( |
1016 |
q|INSERT INTO letter(branchcode,module,code,name,is_html,title,content,message_transport_type) VALUES (?,'my module','tt test','my name',1,?,?,'email')|, |
1017 |
undef, $library->{branchcode}, $title, $content |
1018 |
); |
1019 |
|
1020 |
my $tables = { |
1021 |
borrowers => $borrowernumber, |
1022 |
branches => $library->{branchcode}, |
1023 |
biblio => $biblionumber, |
1024 |
}; |
1025 |
my $substitute = { |
1026 |
status => 'overdue', |
1027 |
}; |
1028 |
my $prepared_letter = GetPreparedLetter( |
1029 |
module => 'my module', |
1030 |
branchcode => $library->{branchcode}, |
1031 |
letter_code => 'tt test', |
1032 |
tables => $tables, |
1033 |
substitute => $substitute, |
1034 |
repeat => [], |
1035 |
); |
1036 |
|
1037 |
is( |
1038 |
$prepared_letter->{content}, |
1039 |
'Dear Robert [% USE Categories %][% Categories.all().search_related("borrowers").count() %]', |
1040 |
'Template toolkit syntax in parameter was not evaluated.' |
1041 |
); |
1042 |
}; |