[Rt-commit] rt branch, 4.0/search-builder-cf-quotes-fix, updated. rt-4.0.2-69-g0cc9c7c

? sunnavy sunnavy at bestpractical.com
Thu Sep 15 02:37:05 EDT 2011


The branch, 4.0/search-builder-cf-quotes-fix has been updated
       via  0cc9c7c8dd08ce940b631972ce0e04e87fad609d (commit)
      from  4ee7ab86aa0d6e0fad971a13e4f42f8de302a04d (commit)

Summary of changes:
 t/web/search_cf_quotes.t |   53 ++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 53 insertions(+), 0 deletions(-)
 create mode 100644 t/web/search_cf_quotes.t

- Log -----------------------------------------------------------------
commit 0cc9c7c8dd08ce940b631972ce0e04e87fad609d
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Thu Sep 15 14:34:49 2011 +0800

    test cf with quotes in search

diff --git a/t/web/search_cf_quotes.t b/t/web/search_cf_quotes.t
new file mode 100644
index 0000000..360fe0d
--- /dev/null
+++ b/t/web/search_cf_quotes.t
@@ -0,0 +1,53 @@
+use strict;
+use warnings;
+
+use RT::Test tests => 24;
+my ( $baseurl, $m ) = RT::Test->started_ok;
+
+my $cf = RT::CustomField->new($RT::SystemUser);
+ok(
+    $cf->Create(
+        Name       => "I'm a cf",
+        Type       => 'Date',
+        LookupType => 'RT::Queue-RT::Ticket',
+    )
+);
+ok( $cf->AddToObject( RT::Queue->new($RT::SystemUser) ) );
+
+RT::Test->create_tickets(
+    { Queue   => 'General' },
+    { Subject => 'ticket foo', 'CustomField-' . $cf->id => '2011-09-15' },
+    { Subject => 'ticket bar', 'CustomField-' . $cf->id => '2011-10-15' },
+    { Subject => 'ticket baz' },
+);
+
+ok( $m->login, 'logged in' );
+
+$m->get_ok('/Search/Build.html');
+$m->form_name( 'BuildQuery' );
+
+my ($cf_op) =
+  $m->find_all_inputs( type => 'option', name_regex => qr/I'm a cf/ );
+my ($cf_field) =
+  $m->find_all_inputs( type => 'text', name_regex => qr/I'm a cf/ );
+
+diag "search directly";
+$m->submit_form(
+    fields    => { $cf_op->name => '<', $cf_field->name => '2011-09-30', },
+    button    => 'DoSearch',
+);
+
+$m->title_is( 'Found 1 ticket', 'found only 1 ticket' );
+$m->content_contains( 'ticket foo', 'has ticket foo' );
+
+diag "first add clause, then search";
+$m->get_ok('/Search/Build.html?NewQuery=1');
+$m->form_name( 'BuildQuery' );
+$m->submit_form(
+    fields    => { $cf_op->name => '<', $cf_field->name => '2011-09-30', },
+    button    => 'AddClause',
+);
+$m->follow_link_ok( { text => 'Show Results' } );
+$m->title_is( 'Found 1 ticket', 'found only 1 ticket' );
+$m->content_contains( 'ticket foo', 'has ticket foo' );
+

-----------------------------------------------------------------------


More information about the Rt-commit mailing list