File: circular_links.t

package info (click to toggle)
request-tracker5 5.0.3%2Bdfsg-3~deb12u3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 77,648 kB
  • sloc: javascript: 187,930; perl: 79,061; sh: 1,302; makefile: 471; python: 37; php: 15
file content (45 lines) | stat: -rw-r--r-- 1,785 bytes parent folder | download | duplicates (10)
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
34
35
36
37
38
39
40
41
42
43
44
45
use strict;
use warnings;

use RT::Test tests => undef;

my ( $foo, $bar, $baz ) = RT::Test->create_tickets(
    { Queue   => 'General' },
    { Subject => 'foo' },
    { Subject => 'bar' },
    { Subject => 'baz' }
);

diag "test circular DependsOn";
my ( $status, $msg ) = $foo->AddLink( Type => 'DependsOn', Target => $bar->id );
ok( $status, "foo depends on bar" );
( $status, $msg ) = $foo->AddLink( Type => 'DependsOn', Base => $bar->id );
ok( !$status, "foo can't be depended on bar" );
( $status, $msg ) = $bar->AddLink( Type => 'DependsOn', Target => $foo->id );
ok( !$status, "bar can't depend on foo back" );
( $status, $msg ) = $bar->AddLink( Type => 'DependsOn', Target => $baz->id );
ok( $status, "bar depends on baz" );
( $status, $msg ) = $baz->AddLink( Type => 'DependsOn', Target => $foo->id );
ok( !$status, "baz can't depend on foo back" );


diag "test circular MemberOf";
( $status, $msg ) = $foo->AddLink( Type => 'MemberOf', Target => $bar->id );
ok( $status, "foo is a member of bar" );
( $status, $msg ) = $foo->AddLink( Type => 'MemberOf', Base => $bar->id );
ok( !$status, "foo can't have member bar" );
( $status, $msg ) = $bar->AddLink( Type => 'MemberOf', Target => $foo->id );
ok( !$status, "bar can't be a member of foo" );
( $status, $msg ) = $bar->AddLink( Type => 'MemberOf', Target => $baz->id );
ok( $status, "baz is a member of bar" );
( $status, $msg ) = $baz->AddLink( Type => 'DependsOn', Target => $foo->id );
ok( !$status, "baz can't be a member of foo" );


diag "test circular RefersTo";
( $status, $msg ) = $foo->AddLink( Type => 'RefersTo', Target => $bar->id );
ok( $status, "foo refers to bar" );
( $status, $msg ) = $foo->AddLink( Type => 'RefersTo', Base => $bar->id );
ok( $status, "foo can be referred to by bar" );

done_testing;