X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=rt%2Ft%2Fapproval%2Fbasic.t;h=2d00eb56e3e64488fb1fd92cba1c190f2ec4f6cc;hb=a60615bf7bde77aa2b9faf3fc268c149eecdb5ab;hp=59745912552e00fb4ce4e1883e74d190d558fb69;hpb=63a268637b2d51a8766412617724b9436439deb6;p=freeside.git diff --git a/rt/t/approval/basic.t b/rt/t/approval/basic.t index 597459125..2d00eb56e 100644 --- a/rt/t/approval/basic.t +++ b/rt/t/approval/basic.t @@ -1,28 +1,24 @@ - use strict; use warnings; -use Test::More; +use RT::Test tests => undef; BEGIN { - eval { require Email::Abstract; require Test::Email; 1 } - or plan skip_all => 'require Email::Abstract and Test::Email'; + plan skip_all => 'Email::Abstract and Test::Email required.' + unless eval { require Email::Abstract; require Test::Email; 1 }; + plan tests => 38; } - -use RT; -use RT::Test tests => 39; use RT::Test::Email; RT->Config->Set( LogToScreen => 'debug' ); RT->Config->Set( UseTransactionBatch => 1 ); -my ($baseurl, $m) = RT::Test->started_ok; -my $q = RT::Queue->new($RT::SystemUser); +my $q = RT::Queue->new(RT->SystemUser); $q->Load('___Approvals'); $q->SetDisabled(0); my %users; for my $user_name (qw(minion cfo ceo )) { - my $user = $users{$user_name} = RT::User->new($RT::SystemUser); + my $user = $users{$user_name} = RT::User->new(RT->SystemUser); $user->Create( Name => uc($user_name), Privileged => 1, EmailAddress => $user_name.'@company.com'); @@ -61,16 +57,16 @@ Your CFO approved PO ticket {$Tickets{"TOP"}->Id} for minion. you ok with that? ENDOFCONTENT '; -my $apptemp = RT::Template->new($RT::SystemUser); +my $apptemp = RT::Template->new(RT->SystemUser); $apptemp->Create( Content => $approvals, Name => "PO Approvals", Queue => "0"); ok($apptemp->Id); -$q = RT::Queue->new($RT::SystemUser); +$q = RT::Queue->new(RT->SystemUser); $q->Create(Name => 'PO'); ok ($q->Id, "Created PO queue"); -my $scrip = RT::Scrip->new($RT::SystemUser); +my $scrip = RT::Scrip->new(RT->SystemUser); my ($sval, $smsg) =$scrip->Create( ScripCondition => 'On Create', ScripAction => 'Create Tickets', Template => 'PO Approvals', @@ -82,7 +78,7 @@ ok ($scrip->TemplateObj->Id, "Created the scrip template"); ok ($scrip->ConditionObj->Id, "Created the scrip condition"); ok ($scrip->ActionObj->Id, "Created the scrip action"); -my $t = RT::Ticket->new($RT::SystemUser); +my $t = RT::Ticket->new(RT->SystemUser); my ($tid, $ttrans, $tmsg); mail_ok { @@ -172,7 +168,7 @@ mail_ok { to => 'minion@company.com', subject => qr/Ticket Approved:/, body => qr/approved by CEO.*Its Owner may now start to act on it.*notes: And consumed they will be/s, -}, { from => qr'CEO via RT', +}, { from => qr/CEO via RT/, to => 'root@localhost', subject => qr/Ticket Approved/, body => qr/The ticket has been approved, you may now start to act on it/,