[Rt-commit] rt branch, new-style-templates, updated. rt-3.8.8-215-gb83cced

Shawn Moore sartak at bestpractical.com
Mon Jul 26 18:32:27 EDT 2010


The branch, new-style-templates has been updated
       via  b83ccedd6b2e0481c45fa26a8fb8f759b0751fe9 (commit)
      from  fa53fb4cd6a2c4e4a3598f5e26557b977c9a88cf (commit)

Summary of changes:
 t/api/template-simple.t |   27 +++++++++++++++++++++------
 1 files changed, 21 insertions(+), 6 deletions(-)

- Log -----------------------------------------------------------------
commit b83ccedd6b2e0481c45fa26a8fb8f759b0751fe9
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Mon Jul 26 18:34:04 2010 -0400

    Test for transaction custom field variables

diff --git a/t/api/template-simple.t b/t/api/template-simple.t
index 8eaf65c..401d421 100644
--- a/t/api/template-simple.t
+++ b/t/api/template-simple.t
@@ -1,25 +1,35 @@
 use strict;
 use warnings;
 use RT;
-use RT::Test tests => 161;
+use RT::Test tests => 167;
 
-my $cf = RT::CustomField->new($RT::SystemUser);
-$cf->Create(
+my $queue = RT::Queue->new($RT::SystemUser);
+$queue->Load("General");
+
+my $ticket_cf = RT::CustomField->new($RT::SystemUser);
+$ticket_cf->Create(
     Name        => 'Department',
     Queue       => '0',
-    SortOrder   => '1',
-    Description => 'A testing custom field',
     Type        => 'FreeformSingle',
 );
 
+my $txn_cf = RT::CustomField->new($RT::SystemUser);
+$txn_cf->Create(
+    Name        => 'Category',
+    LookupType  => RT::Transaction->CustomFieldLookupType,
+    Type        => 'FreeformSingle',
+);
+$txn_cf->AddToObject($queue);
+
 my $ticket = RT::Ticket->new($RT::SystemUser);
 my ($id, $msg) = $ticket->Create(
     Subject   => "template testing",
     Queue     => "General",
     Owner     => 'root at localhost',
     Requestor => ["dom\@example.com"],
+    "CustomField-" . $txn_cf->id => "Special",
 );
-ok($id, "Created ticket");
+ok($id, "Created ticket: $msg");
 my $txn = $ticket->Transactions->First;
 
 $ticket->AddCustomFieldValue(
@@ -102,6 +112,11 @@ SimpleTemplateTest(
 );
 
 SimpleTemplateTest(
+    Content => "\ntest { \$TransactionCFCategory }",
+    Output  => "test Special",
+);
+
+SimpleTemplateTest(
     Content => "\ntest { \$Nonexistent }",
     Output  => "test { \$Nonexistent }",
 );

-----------------------------------------------------------------------


More information about the Rt-commit mailing list