[Rt-commit] rt branch, 4.2/forbid-circular-dependson-and-memberof, updated. rt-4.0.4-380-gc1dd5d5
? sunnavy
sunnavy at bestpractical.com
Thu Jan 26 20:58:57 EST 2012
The branch, 4.2/forbid-circular-dependson-and-memberof has been updated
via c1dd5d57b5639518f39fc5abaffa17647db17f48 (commit)
from bab87785cec849a331423ed4b42c0a58323b8bd8 (commit)
Summary of changes:
t/ticket/circular_links.t | 44 ++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 44 insertions(+), 0 deletions(-)
create mode 100644 t/ticket/circular_links.t
- Log -----------------------------------------------------------------
commit c1dd5d57b5639518f39fc5abaffa17647db17f48
Author: sunnavy <sunnavy at bestpractical.com>
Date: Fri Jan 27 09:45:55 2012 +0800
circular links
diff --git a/t/ticket/circular_links.t b/t/ticket/circular_links.t
new file mode 100644
index 0000000..faffe71
--- /dev/null
+++ b/t/ticket/circular_links.t
@@ -0,0 +1,44 @@
+use strict;
+use warnings;
+
+use RT::Test tests => 21;
+
+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" );
+
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list