X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=rt%2Ft%2Fticket%2Fsearch_by_watcher.t;h=4fbc2617bbbeda93def736c04bcf94e26efe2c7f;hb=752e12c741bcb43a1b3eec64c213452adc56b843;hp=a6800bbb454ee34243d30e32869b1a796347e270;hpb=7588a4ac90a9b07c08a3107cd1107d773be1c991;p=freeside.git diff --git a/rt/t/ticket/search_by_watcher.t b/rt/t/ticket/search_by_watcher.t index a6800bbb4..4fbc2617b 100644 --- a/rt/t/ticket/search_by_watcher.t +++ b/rt/t/ticket/search_by_watcher.t @@ -2,7 +2,7 @@ use strict; use warnings; -use RT::Test nodata => 1, tests => 2108; +use RT::Test nodata => 1, tests => undef; use RT::Ticket; my $q = RT::Test->load_or_create_queue( Name => 'Regression' ); @@ -101,40 +101,41 @@ sub run_auto_tests { run_test( $query, %checks ); } } } -# XXX: It -# @queries = ( -# '? AND ? AND ?' => sub { $_[0] and $_[1] and $_[2] }, -# '(? OR ?) AND ?' => sub { return (($_[0] or $_[1]) and $_[2]) }, -# '? OR (? AND ?)' => sub { $_[0] or ($_[1] and $_[2]) }, -# '(? AND ?) OR ?' => sub { ($_[0] and $_[1]) or $_[2] }, -# '? AND (? OR ?)' => sub { $_[0] and ($_[1] or $_[2]) }, -# '? OR ? OR ?' => sub { $_[0] or $_[1] or $_[2] }, -# ); -# while ( my ($template, $t_cb) = splice @queries, 0, 2 ) { -# my @atmp = @conditions; -# while ( my ($a, $a_cb) = splice @atmp, 0, 2 ) { -# my @btmp = @conditions; -# while ( my ($b, $b_cb) = splice @btmp, 0, 2 ) { -# next if $a eq $b; -# my @ctmp = @conditions; -# while ( my ($c, $c_cb) = splice @ctmp, 0, 2 ) { -# next if $a eq $c; -# next if $b eq $c; -# -# my %checks = (); -# foreach my $ticket ( @tickets ) { -# my $s = $ticket->Subject; -# $checks{ $s } = $t_cb->( scalar $a_cb->($s), scalar $b_cb->($s), scalar $c_cb->($s) ); -# } -# -# my $query = $template; -# foreach my $tmp ($a, $b, $c) { -# $query =~ s/\?/$tmp/; -# } -# -# run_test( $query, %checks ); -# } } } -# } + return unless $ENV{'RT_TEST_HEAVY'}; + + @queries = ( + '? AND ? AND ?' => sub { $_[0] and $_[1] and $_[2] }, + '(? OR ?) AND ?' => sub { return (($_[0] or $_[1]) and $_[2]) }, + '? OR (? AND ?)' => sub { $_[0] or ($_[1] and $_[2]) }, + '(? AND ?) OR ?' => sub { ($_[0] and $_[1]) or $_[2] }, + '? AND (? OR ?)' => sub { $_[0] and ($_[1] or $_[2]) }, + '? OR ? OR ?' => sub { $_[0] or $_[1] or $_[2] }, + ); + while ( my ($template, $t_cb) = splice @queries, 0, 2 ) { + my @atmp = @conditions; + while ( my ($a, $a_cb) = splice @atmp, 0, 2 ) { + my @btmp = @conditions; + while ( my ($b, $b_cb) = splice @btmp, 0, 2 ) { + next if $a eq $b; + my @ctmp = @conditions; + while ( my ($c, $c_cb) = splice @ctmp, 0, 2 ) { + next if $a eq $c; + next if $b eq $c; + + my %checks = (); + foreach my $ticket ( @tickets ) { + my $s = $ticket->Subject; + $checks{ $s } = $t_cb->( scalar $a_cb->($s), scalar $b_cb->($s), scalar $c_cb->($s) ); + } + + my $query = $template; + foreach my $tmp ($a, $b, $c) { + $query =~ s/\?/$tmp/; + } + + run_test( $query, %checks ); + } } } + } } @@ -266,4 +267,4 @@ my $nobody = RT::Nobody(); } @tickets = (); - +done_testing();