summaryrefslogtreecommitdiff
path: root/rt/t/api/tickets_overlay_sql.t
diff options
context:
space:
mode:
authorivan <ivan>2011-04-18 23:15:19 +0000
committerivan <ivan>2011-04-18 23:15:19 +0000
commitb5c4237a34aef94976bc343c8d9e138664fc3984 (patch)
treeba7cb2c13c199b1012c661fcf4f248e7b7e3d36f /rt/t/api/tickets_overlay_sql.t
parent96a0d937cdfe26d691e59139088e33e0bc3e1184 (diff)
parent75162bb14b3e38d66617077843f4dfdcaf09d5c4 (diff)
This commit was generated by cvs2svn to compensate for changes in r11022,
which included commits to RCS files with non-trunk default branches.
Diffstat (limited to 'rt/t/api/tickets_overlay_sql.t')
-rw-r--r--rt/t/api/tickets_overlay_sql.t27
1 files changed, 25 insertions, 2 deletions
diff --git a/rt/t/api/tickets_overlay_sql.t b/rt/t/api/tickets_overlay_sql.t
index 798088664..5bc614077 100644
--- a/rt/t/api/tickets_overlay_sql.t
+++ b/rt/t/api/tickets_overlay_sql.t
@@ -1,7 +1,6 @@
use RT;
-use RT::Test tests => 7;
-
+use RT::Test tests => 19;
{
@@ -33,6 +32,7 @@ my $string = 'subject/content SQL test';
my $t = RT::Ticket->new($RT::SystemUser);
ok( $t->Create( Queue => 'General',
+ Requestor => 'jesse@example.com',
Subject => 'another ticket',
MIMEObj => $Message,
MemberOf => $created[0]
@@ -66,7 +66,30 @@ my $string = 'subject/content SQL test';
is ($count, scalar @created, "number of returned tickets same as entered");
}
+diag "Make sure we don't barf on invalid input for IS / IS NOT";
+{
+ my ($status, $msg) = $tix->FromSQL("Subject IS 'foobar'");
+ ok ($status, "valid query") or diag("error: $msg");
+ is $tix->Count, 0, "found no tickets";
+ unlike $tix->BuildSelectQuery, qr/foobar/, "didn't find foobar in the select";
+ like $tix->BuildSelectQuery, qr/Subject IS NULL/, "found right clause";
+
+ my ($status, $msg) = $tix->FromSQL("Subject IS NOT 'foobar'");
+ ok ($status, "valid query") or diag("error: $msg");
+ is $tix->Count, 2, "found two tickets";
+ unlike $tix->BuildSelectQuery, qr/foobar/, "didn't find foobar in the select";
+ like $tix->BuildSelectQuery, qr/Subject IS NOT NULL/, "found right clause";
+}
+
+{
+ my ($status, $msg) = $tix->FromSQL("Requestor.Signature LIKE 'foo'");
+ ok (!$status, "invalid query - Signature not valid") or diag("error: $msg");
+ my ($status, $msg) = $tix->FromSQL("Requestor.EmailAddress LIKE 'jesse'");
+ ok ($status, "valid query") or diag("error: $msg");
+ is $tix->Count, 1, "found one ticket";
+ like $tix->First->Subject, qr/another ticket/, "found the right ticket";
+}
}