|
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 => 99; |
21 |
use Test::More tests => 100; |
| 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 1410-1412
subtest 'Test message_id parameter for SendQueuedMessages' => sub {
Link Here
|
| 1410 |
is( $message_1->{status}, 'failed', 'Message 1 status is unchanged' ); |
1410 |
is( $message_1->{status}, 'failed', 'Message 1 status is unchanged' ); |
| 1411 |
is( $message_2->{status}, 'sent', 'Valid from_address => status sent' ); |
1411 |
is( $message_2->{status}, 'sent', 'Valid from_address => status sent' ); |
| 1412 |
}; |
1412 |
}; |
| 1413 |
- |
1413 |
|
|
|
1414 |
subtest 'Template toolkit syntax in parameters' => sub { |
| 1415 |
|
| 1416 |
my $borrowernumber = Koha::Patron->new( |
| 1417 |
{ |
| 1418 |
firstname => 'Robert', |
| 1419 |
surname => '[% USE Categories %][% Categories.all().search_related("borrowers").count() %]', |
| 1420 |
categorycode => $patron_category, |
| 1421 |
branchcode => $library->{branchcode}, |
| 1422 |
dateofbirth => $date, |
| 1423 |
smsalertnumber => undef, |
| 1424 |
} |
| 1425 |
)->store->borrowernumber; |
| 1426 |
|
| 1427 |
my $title = q|<<branches.branchname>> - <<status>>|; |
| 1428 |
my $content = q{Dear <<borrowers.firstname>> <<borrowers.surname>>}; |
| 1429 |
|
| 1430 |
$dbh->do( |
| 1431 |
q|INSERT INTO letter(branchcode,module,code,name,is_html,title,content,message_transport_type) VALUES (?,'my module','tt test','my name',1,?,?,'email')|, |
| 1432 |
undef, $library->{branchcode}, $title, $content |
| 1433 |
); |
| 1434 |
|
| 1435 |
my $tables = { |
| 1436 |
borrowers => $borrowernumber, |
| 1437 |
branches => $library->{branchcode}, |
| 1438 |
biblio => $biblionumber, |
| 1439 |
}; |
| 1440 |
my $substitute = { |
| 1441 |
status => 'overdue', |
| 1442 |
}; |
| 1443 |
my $prepared_letter = GetPreparedLetter( |
| 1444 |
module => 'my module', |
| 1445 |
branchcode => $library->{branchcode}, |
| 1446 |
letter_code => 'tt test', |
| 1447 |
tables => $tables, |
| 1448 |
substitute => $substitute, |
| 1449 |
repeat => [], |
| 1450 |
); |
| 1451 |
|
| 1452 |
is( |
| 1453 |
$prepared_letter->{content}, |
| 1454 |
'Dear Robert [% USE Categories %][% Categories.all().search_related("borrowers").count() %]', |
| 1455 |
'Template toolkit syntax in parameter was not evaluated.' |
| 1456 |
); |
| 1457 |
}; |