[Rt-commit] rt branch, new-style-templates, updated. rt-3.8.8-178-g2842cdc
Shawn Moore
sartak at bestpractical.com
Mon Jul 19 18:22:51 EDT 2010
The branch, new-style-templates has been updated
via 2842cdc044ab5b4687d7c04beac3bea5bd340734 (commit)
from 524f14856c335e26226b84135dfb6cc967ea41f9 (commit)
Summary of changes:
t/api/template-simple.t | 65 +++++++++++++++++++++++++++++++++++++++--------
1 files changed, 54 insertions(+), 11 deletions(-)
- Log -----------------------------------------------------------------
commit 2842cdc044ab5b4687d7c04beac3bea5bd340734
Author: Shawn M Moore <sartak at bestpractical.com>
Date: Mon Jul 19 18:24:32 2010 -0400
More template tests
diff --git a/t/api/template-simple.t b/t/api/template-simple.t
index e0ace96..ec274ae 100644
--- a/t/api/template-simple.t
+++ b/t/api/template-simple.t
@@ -1,20 +1,63 @@
use strict;
use warnings;
use RT;
-use RT::Test tests => 5;
+use RT::Test tests => 16;
-my $t = RT::Template->new($RT::SystemUser);
-$t->Create(
- Name => "Foo",
- Content => "\ntest",
+my $ticket = RT::Ticket->new($RT::SystemUser);
+my ($id, $msg) = $ticket->Create(
+ Subject => "template testing",
+ Queue => 'General',
+ Requestor => ['dom at example.com'],
);
-ok($t->id, "Created template");
-is($t->Name, "Foo");
-is($t->Content, "\ntest");
+ok($id, 'Created ticket');
-my ($ok, $msg) = $t->Parse;
-ok($ok, $msg);
-is($t->MIMEObj->stringify_body, "test");
+# no interpolation
+{
+ my $t = RT::Template->new($RT::SystemUser);
+ $t->Create(
+ Name => "Foo",
+ Content => "\ntest",
+ );
+ ok($t->id, "Created template");
+ is($t->Name, "Foo");
+ is($t->Content, "\ntest");
+
+ my ($ok, $msg) = $t->Parse(TicketObj => $ticket);
+ ok($ok, $msg);
+ is($t->MIMEObj->stringify_body, "test");
+}
+
+# code interpolation
+{
+ my $t = RT::Template->new($RT::SystemUser);
+ $t->Create(
+ Name => "Foo",
+ Content => "\ntest { 5 * 5 }",
+ );
+ ok($t->id, "Created template");
+ is($t->Name, "Foo");
+ is($t->Content, "\ntest { 5 * 5 }");
+
+ my ($ok, $msg) = $t->Parse(TicketObj => $ticket);
+ ok($ok, $msg);
+ is($t->MIMEObj->stringify_body, "test 25");
+}
+
+# variable interpolation
+{
+ my $t = RT::Template->new($RT::SystemUser);
+ $t->Create(
+ Name => "Foo",
+ Content => "\ntest { \$Requestor }",
+ );
+ ok($t->id, "Created template");
+ is($t->Name, "Foo");
+ is($t->Content, "\ntest { \$Requestor }");
+
+ my ($ok, $msg) = $t->Parse(TicketObj => $ticket);
+ ok($ok, $msg);
+ is($t->MIMEObj->stringify_body, "test dom\@example.com");
+}
1;
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list