[Rt-commit] rt branch, 3.9-trunk, updated. rt-3.8.8-540-g9f8a01f

Shawn Moore sartak at bestpractical.com
Tue Aug 24 18:03:28 EDT 2010


The branch, 3.9-trunk has been updated
       via  9f8a01f53902a0dc9f0b09be9d134d3d06faec6a (commit)
      from  d850c5674c451f40c9b51764b04e990997a1d8f3 (commit)

Summary of changes:
 t/api/link.t |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)

- Log -----------------------------------------------------------------
commit 9f8a01f53902a0dc9f0b09be9d134d3d06faec6a
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Tue Aug 24 18:05:50 2010 -0400

    Add tests for the warnings in t/api/link.t

diff --git a/t/api/link.t b/t/api/link.t
index 4c5a198..232dbd9 100644
--- a/t/api/link.t
+++ b/t/api/link.t
@@ -2,7 +2,7 @@
 use strict;
 use warnings;
 
-use RT::Test tests => 77;
+use RT::Test tests => 83;
 use RT::Test::Web;
 
 use RT::Link;
@@ -33,15 +33,26 @@ my $child = RT::Ticket->new($RT::SystemUser);
 ok $cid, 'created a ticket #'. $cid or diag "error: $msg";
 
 {
+    my @warnings;
+    local $SIG{__WARN__} = sub {
+        push @warnings, "@_";
+    };
+
     clean_links();
     my ($status, $msg) = $parent->AddLink;
     ok(!$status, "didn't create a link: $msg");
+    is(@warnings, 1, "one warning");
+    like(shift @warnings, qr/Base or Target must be specified/, "warned about linking a ticket to itself");
 
     ($status, $msg) = $parent->AddLink( Base => $parent->id );
     ok(!$status, "didn't create a link: $msg");
+    is(@warnings, 1, "one warning");
+    like(shift @warnings, qr/Can't link a ticket to itself/, "warned about linking a ticket to itself");
 
     ($status, $msg) = $parent->AddLink( Base => $parent->id, Type => 'HasMember' );
     ok(!$status, "didn't create a link: $msg");
+    is(@warnings, 1, "one warning");
+    like(shift @warnings, qr/Can't link a ticket to itself/, "warned about linking a ticket to itself");
 }
 
 {

-----------------------------------------------------------------------


More information about the Rt-commit mailing list