import rt 3.4.6
[freeside.git] / rt / lib / t / regression / 12-search.t
index 210d4fe..9cc4aa4 100644 (file)
@@ -6,7 +6,7 @@
 use strict;
 use warnings;
 
-use Test::More tests => 44;
+use Test::More tests => 35;
 use_ok('RT');
 RT::LoadConfig();
 RT::Init();
@@ -38,24 +38,6 @@ ok($cf3->id, "Created the SearchTest3 CF");
 my $cflabel3 = "CustomField-".$cf3->id;
 
 
-# There was a bug involving a missing join to ObjectCustomFields that
-# caused spurious results on negative searches if another custom field
-# with the same name existed on a different queue.  Hence, we make
-# duplicate CFs on a different queue here
-my $dup = RT::Queue->new($RT::SystemUser);
-$dup->Create(Name => $queue . "-Copy");
-ok ($dup->id, "Created the duplicate queue");
-my $dupcf = RT::CustomField->new($RT::SystemUser);
-$dupcf->Create(Name => 'SearchTest', Type => 'Freeform', MaxValues => 0, Queue => $dup->id);
-ok($dupcf->id, "Created the duplicate SearchTest CF");
-$dupcf = RT::CustomField->new($RT::SystemUser);
-$dupcf->Create(Name => 'SearchTest2', Type => 'Freeform', MaxValues => 0, Queue => $dup->id);
-ok($dupcf->id, "Created the SearchTest2 CF");
-$dupcf = RT::CustomField->new($RT::SystemUser);
-$dupcf->Create(Name => 'SearchTest3', Type => 'Freeform', MaxValues => 0, Queue => $dup->id);
-ok($dupcf->id, "Created the SearchTest3 CF");
-
-
 # setup some tickets
 # we'll need a small pile of them, to test various combinations and nulls.
 # there's probably a way to think harder and do this with fewer
@@ -166,7 +148,8 @@ is($tix->Count, 5, "matched LIKE subject");
 
 $tix = RT::Tickets->new($RT::SystemUser);
 $tix->FromSQL("Queue = '$queue' AND CF.SearchTest IS NULL");
-is($tix->Count, 2, "IS null CF");
+    
+    is($tix->Count, 2, "IS null CF");
 
 $tix = RT::Tickets->new($RT::SystemUser);
 $tix->FromSQL("Queue = '$queue' AND Requestors LIKE 'search1'");
@@ -180,9 +163,14 @@ $tix = RT::Tickets->new($RT::SystemUser);
 $tix->FromSQL("Queue = '$queue' AND Requestors LIKE 'search'");
 is($tix->Count, 6, "LIKE requestor");
 
-$tix = RT::Tickets->new($RT::SystemUser);
-$tix->FromSQL("Queue = '$queue' AND Requestors IS NULL");
-is($tix->Count, 1, "Search for no requestor");
+TODO: {
+    
+    local $TODO = "Can't search for 'no requestor"; 
+    $tix = RT::Tickets->new($RT::SystemUser);
+    $tix->FromSQL("Queue = '$queue' AND Requestors IS NULL");
+    is($tix->Count, 1, "Search for no requestor");
+
+};
 
 $tix = RT::Tickets->new($RT::SystemUser);
 $tix->FromSQL("Queue = '$queue' AND Subject = 'SearchTest1'");
@@ -235,32 +223,13 @@ is($tix->Count, 4, "like cf and like subject");
 
 $tix = RT::Tickets->new($RT::SystemUser);
 $tix->FromSQL("CF.SearchTest IS NULL AND CF.SearchTest2 = 'bar2'");
-is($tix->Count, 1, "null cf and is cf");
+    
+    is($tix->Count, 1, "null cf and is cf");
 
 
 $tix = RT::Tickets->new($RT::SystemUser);
 $tix->FromSQL("Queue = '$queue' AND CF.SearchTest IS NULL AND CF.SearchTest2 IS NULL");
-is($tix->Count, 1, "null cf and null cf"); 
 
-# tests with the same CF listed twice
+        is($tix->Count, 1, "null cf and null cf"); 
 
-$tix = RT::Tickets->new($RT::SystemUser);
-$tix->FromSQL("CF.{SearchTest} = 'foo1'");
-is($tix->Count, 1, "is cf.{name} format");
-
-$tix = RT::Tickets->new($RT::SystemUser);
-$tix->FromSQL("CF.SearchTest = 'foo1' OR CF.SearchTest = 'foo3'");
-is($tix->Count, 2, "is cf1 or is cf1");
-
-$tix = RT::Tickets->new($RT::SystemUser);
-$tix->FromSQL("CF.SearchTest = 'foo1' OR CF.SearchTest IS NULL");
-is($tix->Count, 3, "is cf1 or null cf1");
-
-$tix = RT::Tickets->new($RT::SystemUser);
-$tix->FromSQL("(CF.SearchTest = 'foo1' OR CF.SearchTest = 'foo3') AND (CF.SearchTest2 = 'bar1' OR CF.SearchTest2 = 'bar2')");
-is($tix->Count, 1, "(is cf1 or is cf1) and (is cf2 or is cf2)");
-
-$tix = RT::Tickets->new($RT::SystemUser);
-$tix->FromSQL("CF.SearchTest = 'foo1' OR CF.SearchTest = 'foo3' OR CF.SearchTest2 = 'bar1' OR CF.SearchTest2 = 'bar2'");
-is($tix->Count, 3, "is cf1 or is cf1 or is cf2 or is cf2");