summaryrefslogtreecommitdiff
path: root/rt/t/lifecycles/types.t
blob: 84cfd862774e59fa27c7c6806fd8650fedbb9306 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
use strict;
use warnings;

BEGIN {require  './t/lifecycles/utils.pl'};

is_deeply( [ RT::Lifecycle->ListAll ], [qw/ approvals default delivery /],
       "Get the list of all lifecycles (implicitly for for tickets)");
is_deeply( [ RT::Lifecycle->ListAll('ticket') ],  [qw/ approvals default delivery /],
       "Get the list of all lifecycles for tickets");
is_deeply( [ RT::Lifecycle->List], [qw/ default delivery /],
       "Get the list of lifecycles without approvals (implicitly for for tickets)");
is_deeply( [ RT::Lifecycle->List('ticket') ],  [qw/ default delivery /],
       "Get the list of lifecycles without approvals for tickets");
is_deeply( [ RT::Lifecycle->List('racecar') ], [qw/ racing /],
       "Get the list of lifecycles for other types");

my $tickets = RT::Lifecycle->Load( Name => '', Type => 'ticket' );
ok($tickets, "Got a generalized lifecycle for tickets");
isa_ok( $tickets, "RT::Lifecycle::Ticket", "Is the right subclass" );
is_deeply( [ sort $tickets->Valid ],
           [ sort qw(new open stalled resolved rejected deleted ordered),
             'on way', 'delayed', 'delivered' ],
           "Only gets ticket statuses" );


my $racecars = RT::Lifecycle->Load( Name => '', Type => 'racecar' );
ok($racecars, "Got a generalized lifecycle for racecars");
isa_ok( $racecars, "RT::Lifecycle", "Is the generalized subclass" );
is_deeply( [ sort $racecars->Valid ],
           [ sort ('on-your-mark', 'get-set', 'go', 'first', 'second', 'third', 'no-place') ],
           "Only gets racecar statuses" );

done_testing;