-#!/usr/bin/perl
-
use strict;
+use warnings;
use HTTP::Request::Common;
use HTTP::Cookies;
use LWP;
-use Encode;
-use RT::Test tests => 56;
+use RT::Test tests => 70;
my $cookie_jar = HTTP::Cookies->new;
my ($baseurl, $agent) = RT::Test->started_ok;
# create a custom field with nonascii name and try to add a condition
{
my $cf = RT::CustomField->new( RT->SystemUser );
- $cf->LoadByName( Name => "\x{442}", Queue => 0 );
+ $cf->LoadByName( Name => "\x{442}", LookupType => RT::Ticket->CustomFieldLookupType, ObjectId => 0 );
if ( $cf->id ) {
is($cf->Type, 'Freeform', 'loaded and type is correct');
} else {
ok( $response->is_success, "Fetched " . $url."Search/Build.html" );
ok($agent->form_name('BuildQuery'), "found the form once");
- $agent->field("ValueOf'CF.{\x{442}}'", "\x{441}");
+ $agent->field("ValueOfCF.{\x{442}}", "\x{441}");
$agent->submit();
is( getQueryFromForm($agent),
- "'CF.{\x{442}}' LIKE '\x{441}'",
+ "CF.{\x{442}} LIKE '\x{441}'",
"no changes, no duplicate condition with badly encoded text"
);
);
}
+diag "make sure skipped order by field doesn't break search";
+{
+ my $t = RT::Test->create_ticket( Queue => 'General', Subject => 'test' );
+ ok $t && $t->id, 'created a ticket';
+
+ $agent->get_ok($url."Search/Edit.html");
+ ok($agent->form_name('BuildQueryAdvanced'), "found the form");
+ $agent->field("Query", "id = ". $t->id);
+ $agent->submit;
+
+ $agent->follow_link_ok({id => 'page-results'});
+ ok( $agent->find_link(
+ text => $t->id,
+ url_regex => qr{/Ticket/Display\.html},
+ ), "link to the ticket" );
+
+ $agent->follow_link_ok({id => 'page-edit_search'});
+ $agent->form_name('BuildQuery');
+ $agent->field("OrderBy", 'Requestor.EmailAddress', 3);
+ $agent->submit;
+ $agent->form_name('BuildQuery');
+ is $agent->value('OrderBy', 1), 'id';
+ is $agent->value('OrderBy', 2), '';
+ is $agent->value('OrderBy', 3), 'Requestor.EmailAddress';
+
+ $agent->follow_link_ok({id => 'page-results'});
+ ok( $agent->find_link(
+ text => $t->id,
+ url_regex => qr{/Ticket/Display\.html},
+ ), "link to the ticket" );
+}