Skip to content

Commit

Permalink
Update order on built TicketSQL from simple search in tests
Browse files Browse the repository at this point in the history
Shifting from "subject" to "default" as aggregator term shifts it to
sorting before "status".
  • Loading branch information
alexmv committed Apr 18, 2014
1 parent 6b44a58 commit 5378f77
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
4 changes: 2 additions & 2 deletions t/ticket/simple_search.t
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ my @tests = (
"fulltext:jesse" => "( Content LIKE 'jesse' ) AND ( $active_statuses )",
$queue => "( Queue = '$queue' ) AND ( $active_statuses )",
"root $queue" => "( Owner = 'root' ) AND ( Queue = '$queue' ) AND ( $active_statuses )",
"notauser $queue" => "( Queue = '$queue' ) AND ( $active_statuses ) AND ( Subject LIKE 'notauser' )",
"notauser $queue root" => "( Owner = 'root' ) AND ( Queue = '$queue' ) AND ( $active_statuses ) AND ( Subject LIKE 'notauser' )");
"notauser $queue" => "( Subject LIKE 'notauser' ) AND ( Queue = '$queue' ) AND ( $active_statuses )",
"notauser $queue root" => "( Subject LIKE 'notauser' ) AND ( Owner = 'root' ) AND ( Queue = '$queue' ) AND ( $active_statuses )");

while (my ($from, $to) = splice @tests, 0, 2) {
is($quick->QueryToSQL($from), $to, "<$from> -> <$to>");
Expand Down
19 changes: 10 additions & 9 deletions t/web/simple_search.t
Original file line number Diff line number Diff line change
Expand Up @@ -26,35 +26,36 @@ ok $two_words_queue && $two_words_queue->id, 'loaded or created a queue';
TicketsObj => $tickets,
Argument => '',
);
is $parser->QueryToSQL("foo"), "$active AND ( Subject LIKE 'foo' )", "correct parsing";
is $parser->QueryToSQL("foo"), "( Subject LIKE 'foo' ) AND $active", "correct parsing";
is $parser->QueryToSQL("1 foo"), "( Subject LIKE 'foo' AND Subject LIKE '1' ) AND $active", "correct parsing";
is $parser->QueryToSQL("1"), "( Id = 1 )", "correct parsing";
is $parser->QueryToSQL("#1"), "( Id = 1 )", "correct parsing";
is $parser->QueryToSQL("'1'"), "$active AND ( Subject LIKE '1' )", "correct parsing";
is $parser->QueryToSQL("'1'"), "( Subject LIKE '1' ) AND $active", "correct parsing";

is $parser->QueryToSQL("foo bar"),
"$active AND ( Subject LIKE 'foo' AND Subject LIKE 'bar' )",
"( Subject LIKE 'foo' AND Subject LIKE 'bar' ) AND $active",
"correct parsing";
is $parser->QueryToSQL("'foo bar'"),
"$active AND ( Subject LIKE 'foo bar' )",
"( Subject LIKE 'foo bar' ) AND $active",
"correct parsing";

is $parser->QueryToSQL("'foo \\' bar'"),
"$active AND ( Subject LIKE 'foo \\' bar' )",
"( Subject LIKE 'foo \\' bar' ) AND $active",
"correct parsing";
is $parser->QueryToSQL('"foo \' bar"'),
"$active AND ( Subject LIKE 'foo \\' bar' )",
"( Subject LIKE 'foo \\' bar' ) AND $active",
"correct parsing";
is $parser->QueryToSQL('"\f\o\o"'),
"$active AND ( Subject LIKE '\\\\f\\\\o\\\\o' )",
"( Subject LIKE '\\\\f\\\\o\\\\o' ) AND $active",
"correct parsing";

is $parser->QueryToSQL("General"), "( Queue = 'General' ) AND $active", "correct parsing";
is $parser->QueryToSQL("'Two Words'"), "$active AND ( Subject LIKE 'Two Words' )", "correct parsing";
is $parser->QueryToSQL("'Two Words'"), "( Subject LIKE 'Two Words' ) AND $active", "correct parsing";
is $parser->QueryToSQL("queue:'Two Words'"), "( Queue = 'Two Words' ) AND $active", "correct parsing";
is $parser->QueryToSQL("subject:'Two Words'"), "$active AND ( Subject LIKE 'Two Words' )", "correct parsing";

is $parser->QueryToSQL("me"), "( Owner.id = '__CurrentUser__' ) AND $active", "correct parsing";
is $parser->QueryToSQL("'me'"), "$active AND ( Subject LIKE 'me' )", "correct parsing";
is $parser->QueryToSQL("'me'"), "( Subject LIKE 'me' ) AND $active", "correct parsing";
is $parser->QueryToSQL("owner:me"), "( Owner.id = '__CurrentUser__' ) AND $active", "correct parsing";
is $parser->QueryToSQL("owner:'me'"), "( Owner = 'me' ) AND $active", "correct parsing";
is $parser->QueryToSQL('owner:root@localhost'), "( Owner.EmailAddress = 'root\@localhost' ) AND $active", "Email address as owner";
Expand Down

0 comments on commit 5378f77

Please sign in to comment.