rt 4.2.14 (#13852)
[freeside.git] / rt / t / lifecycles / types.t
1 use strict;
2 use warnings;
3
4 BEGIN {require  './t/lifecycles/utils.pl'};
5
6 is_deeply( [ RT::Lifecycle->ListAll ], [qw/ approvals default delivery /],
7        "Get the list of all lifecycles (implicitly for for tickets)");
8 is_deeply( [ RT::Lifecycle->ListAll('ticket') ],  [qw/ approvals default delivery /],
9        "Get the list of all lifecycles for tickets");
10 is_deeply( [ RT::Lifecycle->List], [qw/ default delivery /],
11        "Get the list of lifecycles without approvals (implicitly for for tickets)");
12 is_deeply( [ RT::Lifecycle->List('ticket') ],  [qw/ default delivery /],
13        "Get the list of lifecycles without approvals for tickets");
14 is_deeply( [ RT::Lifecycle->List('racecar') ], [qw/ racing /],
15        "Get the list of lifecycles for other types");
16
17 my $tickets = RT::Lifecycle->Load( Name => '', Type => 'ticket' );
18 ok($tickets, "Got a generalized lifecycle for tickets");
19 isa_ok( $tickets, "RT::Lifecycle::Ticket", "Is the right subclass" );
20 is_deeply( [ sort $tickets->Valid ],
21            [ sort qw(new open stalled resolved rejected deleted ordered),
22              'on way', 'delayed', 'delivered' ],
23            "Only gets ticket statuses" );
24
25
26 my $racecars = RT::Lifecycle->Load( Name => '', Type => 'racecar' );
27 ok($racecars, "Got a generalized lifecycle for racecars");
28 isa_ok( $racecars, "RT::Lifecycle", "Is the generalized subclass" );
29 is_deeply( [ sort $racecars->Valid ],
30            [ sort ('on-your-mark', 'get-set', 'go', 'first', 'second', 'third', 'no-place') ],
31            "Only gets racecar statuses" );
32
33 done_testing;