"Fossies" - the Fresh Open Source Software Archive

Member "rt-5.0.2/t/api/condition-ownerchange.t" (14 Sep 2021, 1299 Bytes) of package /linux/misc/rt-5.0.2.tar.gz:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 
    2 use strict;
    3 use warnings;
    4 use RT;
    5 use RT::Test tests => 11;
    6 
    7 
    8 {
    9 
   10 my $q = RT::Queue->new(RT->SystemUser);
   11 $q->Create(Name =>'ownerChangeTest');
   12 
   13 ok($q->Id, "Created a scriptest queue");
   14 
   15 my $s1 = RT::Scrip->new(RT->SystemUser);
   16 my ($val, $msg) =$s1->Create( Queue => $q->Id,
   17              ScripAction => 'User Defined',
   18              ScripCondition => 'On Owner Change',
   19              CustomIsApplicableCode => '',
   20              CustomPrepareCode => 'return 1',
   21              CustomCommitCode => '
   22                     $self->TicketObj->SetPriority($self->TicketObj->Priority+1);
   23                 return(1);
   24             ',
   25              Template => 'Blank'
   26     );
   27 ok($val,$msg);
   28 
   29 my $ticket = RT::Ticket->new(RT->SystemUser);
   30 my ($tv,$ttv,$tm) = $ticket->Create(Queue => $q->Id,
   31                                     Subject => "hair on fire",
   32                                     InitialPriority => '20'
   33                                     );
   34 ok($tv, $tm);
   35 ok($ticket->SetOwner('root'));
   36 is ($ticket->Priority , '21', "Ticket priority is set right");
   37 ok($ticket->Steal);
   38 is ($ticket->Priority , '22', "Ticket priority is set right");
   39 ok($ticket->Untake);
   40 is ($ticket->Priority , '23', "Ticket priority is set right");
   41 ok($ticket->Take);
   42 is ($ticket->Priority , '24', "Ticket priority is set right");
   43 
   44 
   45 
   46 
   47 
   48 
   49 }
   50