diff options
author | ivan <ivan> | 2008-03-02 04:06:06 +0000 |
---|---|---|
committer | ivan <ivan> | 2008-03-02 04:06:06 +0000 |
commit | 9c68254528b6f2c7d8c1921b452fa56064783782 (patch) | |
tree | 09623ba39355e74f1cff2f3c35b7347bd309f306 /rt/lib/t/regression/12-search.t | |
parent | ef20b2b6b1feb47ad02b5ff7525f1a0fd11d0fa4 (diff) |
import rt 3.4.6
Diffstat (limited to 'rt/lib/t/regression/12-search.t')
-rw-r--r-- | rt/lib/t/regression/12-search.t | 59 |
1 files changed, 14 insertions, 45 deletions
diff --git a/rt/lib/t/regression/12-search.t b/rt/lib/t/regression/12-search.t index 210d4fe33..9cc4aa441 100644 --- a/rt/lib/t/regression/12-search.t +++ b/rt/lib/t/regression/12-search.t @@ -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"); |