summaryrefslogtreecommitdiff
path: root/rt/lib/t/regression/01ticket_link_searching.t
diff options
context:
space:
mode:
authorivan <ivan>2008-03-02 04:06:06 +0000
committerivan <ivan>2008-03-02 04:06:06 +0000
commit9c68254528b6f2c7d8c1921b452fa56064783782 (patch)
tree09623ba39355e74f1cff2f3c35b7347bd309f306 /rt/lib/t/regression/01ticket_link_searching.t
parentef20b2b6b1feb47ad02b5ff7525f1a0fd11d0fa4 (diff)
import rt 3.4.6
Diffstat (limited to 'rt/lib/t/regression/01ticket_link_searching.t')
-rw-r--r--rt/lib/t/regression/01ticket_link_searching.t96
1 files changed, 46 insertions, 50 deletions
diff --git a/rt/lib/t/regression/01ticket_link_searching.t b/rt/lib/t/regression/01ticket_link_searching.t
index a402c7376..6d10221c1 100644
--- a/rt/lib/t/regression/01ticket_link_searching.t
+++ b/rt/lib/t/regression/01ticket_link_searching.t
@@ -1,6 +1,6 @@
#!/usr/bin/perl -w
-use Test::More tests => 30;
+use Test::More tests => 25;
use strict;
use RT;
@@ -17,46 +17,54 @@ my $queue = new RT::Queue($CurrentUser);
$queue->Load('General') || Abort(loc("Queue could not be loaded."));
my $child_ticket = new RT::Ticket( $CurrentUser );
-my ($childid) = $child_ticket->Create(
- Subject => 'test child',
- Queue => $queue->Id,
-);
-ok($childid, "We created a child ticket");
+
+my ( $childid ) = $child_ticket->Create
+ ( Subject => 'test child',
+ Queue => $queue->Id);
+
+ok($childid != 0);
my $parent_ticket = new RT::Ticket( $CurrentUser );
-my ($parentid) = $parent_ticket->Create(
- Subject => 'test parent',
- Children => [ $childid ],
- Queue => $queue->Id,
-);
-ok($parentid, "We created a parent ticket");
+my ( $parentid ) = $parent_ticket->Create
+ ( Subject => 'test parent',
+ Children => [$childid],
+ Queue => $queue->Id);
+
+ok($parentid != 0, "We created a parent ticket");
my $Collection = RT::Tickets->new($CurrentUser);
-$Collection->LimitMemberOf( $parentid );
+$Collection->LimitMemberOf ($parentid);
+
+ok ($Collection->First);
+is ($Collection->First->id, $childid, "We found the collection of all children of $parentid with Limit");
is($Collection->Count,1, "We found only one result");
-ok($Collection->First);
-is($Collection->First->id, $childid, "We found the collection of all children of $parentid with Limit");
$Collection = RT::Tickets->new($CurrentUser);
-$Collection->FromSQL("MemberOf = $parentid");
-is($Collection->Count, 1, "We found only one result");
-ok($Collection->First);
-is($Collection->First->id, $childid, "We found the collection of all children of $parentid with TicketSQL");
+$Collection->FromSQL( "MemberOf = $parentid");
+is ($Collection->First->id, $childid, "We found the collection of all children of $parentid with TicketSQL");
+is($Collection->Count,1, "We found only one result");
+
+
+
$Collection = RT::Tickets->new($CurrentUser);
$Collection->LimitHasMember ($childid);
+
+ok ($Collection->First);
+is ($Collection->First->id, $parentid, "We found the collection of all parents of $childid with Limit");
is($Collection->Count,1, "We found only one result");
-ok($Collection->First);
-is($Collection->First->id, $parentid, "We found the collection of all parents of $childid with Limit");
+
$Collection = RT::Tickets->new($CurrentUser);
$Collection->FromSQL("HasMember = $childid");
+
+ok ($Collection->First);
+is ($Collection->First->id, $parentid, "We found the collection of all parents of $childid with TicketSQL");
is($Collection->Count,1, "We found only one result");
-ok($Collection->First);
-is($Collection->First->id, $parentid, "We found the collection of all parents of $childid with TicketSQL");
+
# Now we find a collection of all the tickets which have no members. they should have no children.
@@ -67,10 +75,12 @@ my %has;
while (my $t = $Collection->Next) {
++$has{$t->id};
}
-ok( $has{$childid}, "The collection has our child - $childid");
+ok ($has{$childid} , "The collection has our child - $childid");
ok( !$has{$parentid}, "The collection doesn't have our parent - $parentid");
+
+
# Now we find a collection of all the tickets which are not members of anything. they should have no parents.
$Collection = RT::Tickets->new($CurrentUser);
$Collection->LimitMemberOf('');
@@ -92,27 +102,28 @@ ok( !$has{$childid}, "The collection doesn't have our child - $childid");
$Collection = RT::Tickets->new($CurrentUser);
$Collection->FromSQL ("HasMember IS NULL");
# must contain parent; must not contain child
-%has = ();
+ %has = ();
while (my $t = $Collection->Next) {
++$has{$t->id};
}
-ok( !$has{$parentid}, "The collection doesn't have our parent - $parentid");
+ok (!$has{$parentid} , "The collection doesn't have our parent - $parentid");
ok( $has{$childid}, "The collection has our child - $childid");
# Now we find a collection of all the tickets which have no members. they should have no children.
# Alternate syntax
$Collection = RT::Tickets->new($CurrentUser);
-$Collection->FromSQL("HasMember = ''");
+$Collection->FromSQL ("HasMember = ''");
# must contain parent; must not contain child
-%has = ();
+ %has = ();
while (my $t = $Collection->Next) {
++$has{$t->id};
}
-ok( !$has{$parentid}, "The collection doesn't have our parent - $parentid");
+ok (!$has{$parentid} , "The collection doesn't have our parent - $parentid");
ok( $has{$childid}, "The collection has our child - $childid");
+
# Now we find a collection of all the tickets which are not members of anything. they should have no parents.
$Collection = RT::Tickets->new($CurrentUser);
$Collection->FromSQL("MemberOf IS NULL");
@@ -121,8 +132,8 @@ $Collection->FromSQL("MemberOf IS NULL");
while (my $t = $Collection->Next) {
++$has{$t->id};
}
-ok( $has{$parentid}, "The collection has our parent - $parentid");
-ok( !$has{$childid}, "The collection doesn't have our child - $childid");
+ok ($has{$parentid} , "The collection has our parent - $parentid");
+ok(!$has{$childid}, "The collection doesn't have our child - $childid");
# Now we find a collection of all the tickets which are not members of anything. they should have no parents.
@@ -133,27 +144,12 @@ $Collection->FromSQL("MemberOf = ''");
while (my $t = $Collection->Next) {
++$has{$t->id};
}
-ok( $has{$parentid}, "The collection has our parent - $parentid");
-ok( !$has{$childid}, "The collection doesn't have our child - $childid");
+ok ($has{$parentid} , "The collection has our parent - $parentid");
+ok(!$has{$childid}, "The collection doesn't have our child - $childid");
-# Now we find a collection of all the tickets which are not members of the parent ticket
-$Collection = RT::Tickets->new($CurrentUser);
-$Collection->FromSQL("MemberOf != $parentid");
-%has = ();
-while (my $t = $Collection->Next) {
- ++$has{$t->id};
-}
-ok( $has{$parentid}, "The collection has our parent - $parentid");
-ok( !$has{$childid}, "The collection doesn't have our child - $childid");
-$Collection = RT::Tickets->new($CurrentUser);
-$Collection->LimitMemberOf($parentid, OPERATOR => '!=');
-%has = ();
-while (my $t = $Collection->Next) {
- ++$has{$t->id};
-}
-ok( $has{$parentid}, "The collection has our parent - $parentid");
-ok( !$has{$childid}, "The collection doesn't have our child - $childid");
1;
+
+