diff options
author | ivan <ivan> | 2007-08-02 19:56:20 +0000 |
---|---|---|
committer | ivan <ivan> | 2007-08-02 19:56:20 +0000 |
commit | 9509e5bfb7f9331303153cac24d7bfecbe2ea9f1 (patch) | |
tree | 7ff1dce47668339f41f0ddea0e31e85d7788d4df /rt/lib/t/regression/25scrip_order.t | |
parent | b052ee7b17d87c95f650857989b33ecffc9089c5 (diff) | |
parent | ef20b2b6b1feb47ad02b5ff7525f1a0fd11d0fa4 (diff) |
This commit was generated by cvs2svn to compensate for changes in r5562,
which included commits to RCS files with non-trunk default branches.
Diffstat (limited to 'rt/lib/t/regression/25scrip_order.t')
-rw-r--r-- | rt/lib/t/regression/25scrip_order.t | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/rt/lib/t/regression/25scrip_order.t b/rt/lib/t/regression/25scrip_order.t new file mode 100644 index 000000000..0e11989e6 --- /dev/null +++ b/rt/lib/t/regression/25scrip_order.t @@ -0,0 +1,57 @@ +#!/usr/bin/perl -w + +use strict; +use Test::More tests => 7; + +use RT; +RT::LoadConfig(); +RT::Init; + +# {{{ test scrip ordering based on description + +my $scrip_queue = RT::Queue->new($RT::SystemUser); +my ($queue_id, $msg) = $scrip_queue->Create( Name => "ScripOrdering-$$", + Description => 'Test scrip ordering by description' ); +ok($queue_id, "Created scrip-ordering test queue? ".$msg); + +my $priority_ten_scrip = RT::Scrip->new($RT::SystemUser); +(my $id, $msg) = $priority_ten_scrip->Create( + Description => "10 set priority $$", + Queue => $queue_id, + ScripCondition => 'On Create', + ScripAction => 'User Defined', + CustomPrepareCode => '$RT::Logger->debug("Setting priority to 10..."); return 1;', + CustomCommitCode => '$self->TicketObj->SetPriority(10);', + Template => 'Blank', + Stage => 'TransactionCreate', +); +ok($id, "Created priority-10 scrip? ".$msg); + +my $priority_five_scrip = RT::Scrip->new($RT::SystemUser); +($id, $msg) = $priority_ten_scrip->Create( + Description => "05 set priority $$", + Queue => $queue_id, + ScripCondition => 'On Create', + ScripAction => 'User Defined', + CustomPrepareCode => '$RT::Logger->debug("Setting priority to 5..."); return 1;', + CustomCommitCode => '$self->TicketObj->SetPriority(5);', + Template => 'Blank', + Stage => 'TransactionCreate', +); +ok($id, "Created priority-5 scrip? ".$msg); + +my $ticket = RT::Ticket->new($RT::SystemUser); +($id, $msg) = $ticket->Create( + Queue => $queue_id, + Requestor => 'order@example.com', + Subject => "Scrip order test $$", +); +ok($ticket->id, "Created ticket? id=$id"); + +ok($ticket->Priority != 0, "Ticket shouldn't be priority 0"); +ok($ticket->Priority != 5, "Ticket shouldn't be priority 5"); +ok($ticket->Priority == 10, "Ticket should be priority 10"); + +# }}} + +1; |