summaryrefslogtreecommitdiffstats
path: root/xt/lib/Bugzilla/Test/Search
diff options
context:
space:
mode:
Diffstat (limited to 'xt/lib/Bugzilla/Test/Search')
-rw-r--r--xt/lib/Bugzilla/Test/Search/Constants.pm22
-rw-r--r--xt/lib/Bugzilla/Test/Search/FieldTest.pm48
-rw-r--r--xt/lib/Bugzilla/Test/Search/FieldTestNormal.pm8
-rw-r--r--xt/lib/Bugzilla/Test/Search/OperatorTest.pm2
-rw-r--r--xt/lib/Bugzilla/Test/Search/OrTest.pm4
5 files changed, 42 insertions, 42 deletions
diff --git a/xt/lib/Bugzilla/Test/Search/Constants.pm b/xt/lib/Bugzilla/Test/Search/Constants.pm
index 85547df46..53f8851fb 100644
--- a/xt/lib/Bugzilla/Test/Search/Constants.pm
+++ b/xt/lib/Bugzilla/Test/Search/Constants.pm
@@ -384,7 +384,7 @@ use constant CHANGED_FROM_TO_BROKEN_NOT => (
"cc" => { contains => [1] },
"estimated_time" => { contains => [1] },
"flagtypes.name" => { contains => [1] },
- "keywords" => { contains => [1] },
+ "keywords" => { contains => [1] },
FIELD_TYPE_MULTI_SELECT, { contains => [1] },
);
@@ -655,7 +655,7 @@ use constant CHANGED_OVERRIDE => (
# on Bug 1. If we did an "anywordssubstr" search test, it would
# become a space-separated string of the first few characters
# of each CC's login name on Bug 1.
-#
+#
# <#-id> - The bug id of the numbered bug.
# <#-reporter> - The login name of the numbered bug's reporter.
# <#-delta> - The delta_ts of the numbered bug.
@@ -723,7 +723,7 @@ use constant TESTS => {
{ contains => [2,3,4,5], value => '^1-', override => REGEX_OVERRIDE },
],
lessthan => [
- { contains => [1], value => 2,
+ { contains => [1], value => 2,
override => {
# A lot of these contain bug 5 because an empty value is validly
# less than the specified value.
@@ -823,11 +823,11 @@ use constant TESTS => {
{ contains => [2,3,4,5], value => '<1>' },
],
anyexact => [
- { contains => [1,2], value => '<1>, <2>',
+ { contains => [1,2], value => '<1>, <2>',
override => { ANY_OVERRIDE } },
],
anywordssubstr => [
- { contains => [1,2], value => '<1> <2>',
+ { contains => [1,2], value => '<1> <2>',
override => {
ANY_OVERRIDE,
percentage_complete => { contains => [1,2,3] },
@@ -849,7 +849,7 @@ use constant TESTS => {
# bug 3 has the value "21" here, so matches "2,1"
percentage_complete => { value => '<2>,<3>', contains => [3] },
# 1 0 matches bug 1, which has both public and private comments.
- 'longdescs.isprivate' => { contains => [1] },
+ 'longdescs.isprivate' => { contains => [1] },
}
},
],
@@ -874,7 +874,7 @@ use constant TESTS => {
override => {
MULTI_BOOLEAN_OVERRIDE,
dependson => { value => '<1> <3>', contains => [1,3] },
- 'longdescs.count' => { contains => [1,2,3,4] },
+ 'longdescs.count' => { contains => [1,2,3,4] },
},
},
],
@@ -914,7 +914,7 @@ use constant TESTS => {
],
changedafter => [
{ contains => [2,3,4], value => '<2-delta>',
- override => {
+ override => {
CHANGED_OVERRIDE,
creation_ts => { contains => [3,4] },
# We only change this for one bug, and it doesn't match.
@@ -1037,10 +1037,10 @@ use constant SPECIAL_PARAM_TESTS => (
contains => [1,2,3,4] },
{ field => 'bug_status', operator => 'anyexact', value => '__all__',
contains => [1,2,3,4,5] },
-
+
{ field => 'resolution', operator => 'anyexact', value => '---',
contains => [5] },
-
+
# email* query parameters.
{ field => 'assigned_to', operator => 'anyexact',
value => '<1>, <2-reporter>', contains => [1,2],
@@ -1051,7 +1051,7 @@ use constant SPECIAL_PARAM_TESTS => (
email2 => generate_random_password(100), emaillongdesc2 => 1,
},
},
-
+
# standard pronouns
{ field => 'assigned_to', operator => 'equals', value => '%assignee%',
contains => [1,2,3,4,5] },
diff --git a/xt/lib/Bugzilla/Test/Search/FieldTest.pm b/xt/lib/Bugzilla/Test/Search/FieldTest.pm
index a625127c9..832c578cc 100644
--- a/xt/lib/Bugzilla/Test/Search/FieldTest.pm
+++ b/xt/lib/Bugzilla/Test/Search/FieldTest.pm
@@ -87,7 +87,7 @@ sub name {
my $field = $self->field;
my $operator = $self->operator;
my $value = $self->main_value;
-
+
my $name = "$field-$operator-$value";
if (my $extra_name = $self->test->{extra_name}) {
$name .= "-$extra_name";
@@ -100,20 +100,20 @@ sub name {
sub test {
my $self = shift;
return $self->{test} if $self->{test};
-
+
my %test = %{ $self->{raw_test} };
-
+
# We have field name overrides...
my $override = $test{override}->{$self->field};
# And also field type overrides.
if (!$override) {
$override = $test{override}->{$self->field_object->type} || {};
}
-
+
foreach my $key (%$override) {
$test{$key} = $override->{$key};
}
-
+
$self->{test} = \%test;
return $self->{test};
}
@@ -122,7 +122,7 @@ sub test {
sub _field_values {
my ($self) = @_;
return $self->{field_values} if $self->{field_values};
-
+
my %field_values;
foreach my $number (1..NUM_BUGS) {
$field_values{$number} = $self->_field_values_for_bug($number);
@@ -264,7 +264,7 @@ sub search_known_broken {
}
return undef;
}
-
+
# Returns a string if we haven't yet implemented the tests for this field,
# but we plan to in the future.
sub field_not_yet_implemented {
@@ -283,7 +283,7 @@ sub invalid_field_operator_combination {
my ($self) = @_;
my $field = $self->field;
my $operator = $self->operator;
-
+
if ($field eq 'content' && $operator !~ /matches/) {
return "content field does not support $operator";
}
@@ -322,7 +322,7 @@ sub search_params {
"type0-0-0" => $self->operator,
"value0-0-0" => $self->translated_value,
);
-
+
$self->{search_params} = \%params;
return $self->{search_params};
}
@@ -373,7 +373,7 @@ sub _field_values_for_bug {
@values = $self->_values_for($number, 'groups_in', 'name');
}
elsif ($field eq 'keywords') {
- @values = $self->_values_for($number, 'keyword_objects', 'name');
+ @values = $self->_values_for($number, 'keyword_objects', 'name');
}
elsif ($field eq 'content') {
@values = $self->_values_for($number, 'short_desc');
@@ -407,7 +407,7 @@ sub _field_values_for_bug {
@values = map { blessed($_) ? $_->login : $_ } @values;
@values = grep { defined $_ } @values;
}
-
+
return \@values;
}
@@ -467,9 +467,9 @@ sub _translate_value {
sub _translate_value_for_bug {
my ($self, $number, $value) = @_;
-
+
my $bug = $self->bug($number);
-
+
my $bug_id = $bug->id;
$value =~ s/<$number-id>/$bug_id/g;
my $bug_delta = $bug->delta_ts;
@@ -482,10 +482,10 @@ sub _translate_value_for_bug {
my $group = $bug_groups[0];
$value =~ s/<$number-bug_group>/$group/g;
}
-
- my @bug_values = $self->bug_values($number);
+
+ my @bug_values = $self->bug_values($number);
return $value if !@bug_values;
-
+
if ($self->operator =~ /substr/) {
@bug_values = map { $self->_substr_value($_) } @bug_values;
}
@@ -505,7 +505,7 @@ sub _translate_value_for_bug {
$string_value = quotemeta($string_value);
}
$value =~ s/<$number>/$string_value/g;
-
+
return $value;
}
@@ -538,11 +538,11 @@ sub _substr_value {
sub run {
my ($self) = @_;
-
+
my $invalid_combination = $self->invalid_field_operator_combination;
my $field_not_implemented = $self->field_not_yet_implemented;
- SKIP: {
+ SKIP: {
skip($invalid_combination, $self->num_tests) if $invalid_combination;
TODO: {
todo_skip ($field_not_implemented, $self->num_tests) if $field_not_implemented;
@@ -556,7 +556,7 @@ sub do_tests {
my $name = $self->name;
my $search_broken = $self->search_known_broken;
-
+
my $search = $self->_test_search_object_creation();
my $sql;
@@ -564,7 +564,7 @@ sub do_tests {
local $TODO = $search_broken if $search_broken;
lives_ok { $sql = $search->_sql } "$name: generate SQL";
}
-
+
my $results;
SKIP: {
skip "Can't run SQL without any SQL", 1 if !defined $sql;
@@ -607,12 +607,12 @@ sub _test_content {
sub _test_content_for_bug {
my ($self, $number, $results, $sql) = @_;
my $name = $self->name;
-
+
my $contains_known_broken = $self->contains_known_broken($number);
-
+
my %result_ids = map { $_->[0] => 1 } @$results;
my $bug_id = $self->bug($number)->id;
-
+
TODO: {
local $TODO = $contains_known_broken if $contains_known_broken;
if ($self->bug_is_contained($number)) {
diff --git a/xt/lib/Bugzilla/Test/Search/FieldTestNormal.pm b/xt/lib/Bugzilla/Test/Search/FieldTestNormal.pm
index 1e0a75f95..8c3ff19ab 100644
--- a/xt/lib/Bugzilla/Test/Search/FieldTestNormal.pm
+++ b/xt/lib/Bugzilla/Test/Search/FieldTestNormal.pm
@@ -78,28 +78,28 @@ sub search_params {
if ($operator eq 'anyexact') {
$value = [split ',', $value];
}
-
+
if (my $ch_param = CH_OPERATOR->{$operator}) {
if ($field eq 'creation_ts') {
$field = '[Bug creation]';
}
return { chfield => $field, $ch_param => $value };
}
-
+
if ($field eq 'delta_ts' and $operator eq 'greaterthaneq') {
return { chfieldfrom => $value };
}
if ($field eq 'delta_ts' and $operator eq 'lessthaneq') {
return { chfieldto => $value };
}
-
+
if ($field eq 'deadline' and $operator eq 'greaterthaneq') {
return { deadlinefrom => $value };
}
if ($field eq 'deadline' and $operator eq 'lessthaneq') {
return { deadlineto => $value };
}
-
+
if (grep { $_ eq $field } EMAIL_FIELDS) {
$field = 'longdesc' if $field eq 'commenter';
return {
diff --git a/xt/lib/Bugzilla/Test/Search/OperatorTest.pm b/xt/lib/Bugzilla/Test/Search/OperatorTest.pm
index f08800471..a6d24ffca 100644
--- a/xt/lib/Bugzilla/Test/Search/OperatorTest.pm
+++ b/xt/lib/Bugzilla/Test/Search/OperatorTest.pm
@@ -70,7 +70,7 @@ sub run {
$normal_test->run();
my $not_test = new Bugzilla::Test::Search::NotTest($field_test);
$not_test->run();
-
+
next if !$self->search_test->option('long');
# Run the OR tests. This tests every other operator (including
diff --git a/xt/lib/Bugzilla/Test/Search/OrTest.pm b/xt/lib/Bugzilla/Test/Search/OrTest.pm
index b1dbf646c..57c235fda 100644
--- a/xt/lib/Bugzilla/Test/Search/OrTest.pm
+++ b/xt/lib/Bugzilla/Test/Search/OrTest.pm
@@ -80,7 +80,7 @@ sub invalid_field_operator_combination {
}
sub search_known_broken {
my ($self) = @_;
- return $self->_join_messages('search_known_broken');
+ return $self->_join_messages('search_known_broken');
}
sub _join_messages {
@@ -111,7 +111,7 @@ sub contains_known_broken {
or ( !$self->bug_is_contained($number)
and $self->_bug_will_actually_be_contained($number) ) )
{
- my @messages = map { $_->contains_known_broken($number) }
+ my @messages = map { $_->contains_known_broken($number) }
$self->field_tests;
@messages = grep { $_ } @messages;
# Sometimes, with things that break because of no_criteria, there won't