use strict;
use warnings;
use RT::Test tests => undef;
-BEGIN {
- plan skip_all => 'Email::Abstract and Test::Email required.'
- unless eval { require Email::Abstract; require Test::Email; 1 };
- plan tests => 38;
-}
use RT::Test::Email;
-RT->Config->Set( LogToScreen => 'debug' );
+RT->Config->Set( LogToSTDERR => 'debug' );
RT->Config->Set( UseTransactionBatch => 1 );
my $q = RT::Queue->new(RT->SystemUser);
Queue: ___Approvals
Type: approval
Owner: CFO
-Requestors: {$Tickets{"TOP"}->Requestors}
Refers-To: TOP
Subject: CFO Approval for PO: {$Tickets{"TOP"}->Id} - {$Tickets{"TOP"}->Subject}
Due: {time + 86400}
Queue: ___Approvals
Type: approval
Owner: CEO
-Requestors: {$Tickets{"TOP"}->Requestors}
Subject: PO approval request for {$Tickets{"TOP"}->Subject}
Refers-To: TOP
Depends-On: for-CFO
$t->Create(Subject => "PO for stationary",
Owner => "root", Requestor => 'minion',
Queue => $q->Id);
-} { from => qr/RT System/,
- to => 'cfo@company.com',
- subject => qr/New Pending Approval: CFO Approval/,
- body => qr/pending your approval.*Your approval is requested.*Blah/s
-},{ from => qr/PO via RT/,
+} { from => qr/PO via RT/,
to => 'minion@company.com',
subject => qr/PO for stationary/,
body => qr/automatically generated in response/
+},{ from => qr/RT System/,
+ to => 'root@localhost',
+ subject => qr/PO for stationary/,
+}, { from => qr/RT System/,
+ to => 'cfo@company.com',
+ subject => qr/New Pending Approval: CFO Approval/,
+ body => qr/pending your approval.*Your approval is requested.*Blah/s
};
ok ($tid,$tmsg);
to => 'ceo@company.com',
subject => qr/New Pending Approval: PO approval request for PO/,
body => qr/pending your approval.*CFO approved.*ok with that\?/s
+},{ from => qr/RT System/,
+ to => 'root@localhost',
+ subject => qr/Ticket Approved:/,
},{ from => qr/RT System/,
to => 'minion@company.com',
subject => qr/Ticket Approved:/,
ok($ok, "ceo can approve - $msg");
} { from => qr/RT System/,
+ to => 'root@localhost',
+ 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/RT System/,
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/,
ok($ok, "cfo can approve - $msg");
} { from => qr/RT System/,
+ to => 'root@localhost',
+ subject => qr/Ticket Rejected: PO for stationary/,
+ body => qr/rejected by CFO.*out of resources/s,
+},{ from => qr/RT System/,
to => 'minion@company.com',
subject => qr/Ticket Rejected: PO for stationary/,
body => qr/rejected by CFO.*out of resources/s,
is_deeply([ $t->Status, $dependson_cfo->Status, $dependson_ceo->Status ],
[ 'rejected', 'rejected', 'deleted'], 'ticket state after cfo rejection');
+done_testing;