summaryrefslogtreecommitdiffstats
path: root/xt/lib
diff options
context:
space:
mode:
authorDylan William Hardison <dylan@hardison.net>2017-07-05 20:43:18 +0200
committerDylan William Hardison <dylan@hardison.net>2017-07-07 00:19:20 +0200
commit37722eca39874bb6abdcd120e3e458bd62dea62b (patch)
tree57a9a9970c00ec77baecab7e154ef7dfcef863fe /xt/lib
parenta6f98de0d4e842351222b0173a1fff151da8738e (diff)
downloadbugzilla-37722eca39874bb6abdcd120e3e458bd62dea62b.tar.gz
bugzilla-37722eca39874bb6abdcd120e3e458bd62dea62b.tar.xz
Bug 1377933 - Remove trailing whitespace from all perl files
Diffstat (limited to 'xt/lib')
-rw-r--r--xt/lib/Bugzilla/Test/Search.pm78
-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
6 files changed, 81 insertions, 81 deletions
diff --git a/xt/lib/Bugzilla/Test/Search.pm b/xt/lib/Bugzilla/Test/Search.pm
index f18d3e4ca..2666455e8 100644
--- a/xt/lib/Bugzilla/Test/Search.pm
+++ b/xt/lib/Bugzilla/Test/Search.pm
@@ -112,15 +112,15 @@ sub num_tests {
# This @{ [] } thing is the only reasonable way to get a count out of a
# constant array.
- my $special_tests = scalar(@{ [SPECIAL_PARAM_TESTS, CUSTOM_SEARCH_TESTS] })
+ my $special_tests = scalar(@{ [SPECIAL_PARAM_TESTS, CUSTOM_SEARCH_TESTS] })
* TESTS_PER_RUN;
-
+
return $operator_field_tests + $sql_injection_tests + $special_tests;
}
sub _total_operator_tests {
my ($self, $operators) = @_;
-
+
# Some operators have more than one test. Find those ones and add
# them to the total operator tests
my $extra_operator_tests;
@@ -131,13 +131,13 @@ sub _total_operator_tests {
$extra_operator_tests += $extra_num;
}
return scalar(@$operators) + $extra_operator_tests;
-
+
}
sub all_operators {
my ($self) = @_;
if (not $self->{all_operators}) {
-
+
my @operators;
if (my $limit_operators = $self->option('operators')) {
@operators = split(',', $limit_operators);
@@ -346,7 +346,7 @@ sub create_legal_value {
sub _create_custom_fields {
my ($self) = @_;
return if !$self->option('add-custom-fields');
-
+
while (my ($type, $name) = each %{ CUSTOM_FIELDS() }) {
my $exists = new Bugzilla::Field({ name => $name });
next if $exists;
@@ -369,7 +369,7 @@ sub _create_custom_fields {
sub _create_field_values {
my ($self, $number, $for_create) = @_;
my $dbh = Bugzilla->dbh;
-
+
Bugzilla->set_user($self->admin);
my @selects = grep { $_->is_select } $self->all_fields;
@@ -414,7 +414,7 @@ sub _create_field_values {
initialqacontact => create_user("$number-defaultqa")->login,
initial_cc => [create_user("$number-initcc")->login],
description => "Component $number" });
-
+
$values{'product'} = $product->name;
$values{'component'} = $component->name;
$values{'target_milestone'} = $milestone;
@@ -432,7 +432,7 @@ sub _create_field_values {
$values{$field} = $value;
}
$values{'tag'} = ["$number-tag-" . random()];
-
+
my @date_fields = grep { $_->type == FIELD_TYPE_DATETIME } $self->all_fields;
foreach my $field (@date_fields) {
# We use 03 as the month because that differs from our creation_ts,
@@ -522,10 +522,10 @@ sub _create_flagtypes {
my $name = "$number-flag-" . random();
my $desc = "FlagType $number";
- my %flagtypes;
+ my %flagtypes;
foreach my $target (qw(a b)) {
$dbh->do("INSERT INTO flagtypes
- (name, description, target_type, is_requestable,
+ (name, description, target_type, is_requestable,
is_requesteeble, is_multiplicable, cc_list)
VALUES (?,?,?,1,1,1,'')",
undef, $name, $desc, $target);
@@ -591,34 +591,34 @@ sub _get_attach_values {
sub _create_one_bug {
my ($self, $number) = @_;
my $dbh = Bugzilla->dbh;
-
+
# We need bug 6 to have a unique alias that is not a clone of bug 1's,
# so we get the alias separately from the other parameters.
my $alias = $self->bug_create_value($number, 'alias');
my $update_alias = $self->bug_update_value($number, 'alias');
-
+
# Otherwise, make bug 6 a clone of bug 1.
my $real_number = $number;
$number = 1 if $number == 6;
-
+
my $reporter = $self->bug_create_value($number, 'reporter');
Bugzilla->set_user(Bugzilla::User->check($reporter));
-
+
# We create the bug with one set of values, and then we change it
# to have different values.
my %params = %{ $self->_bug_create_values->{$number} };
$params{alias} = $alias;
-
+
# There are some things in bug_create_values that shouldn't go into
# create().
delete @params{qw(attachment set_flags tag)};
-
- my ($status, $resolution, $see_also) =
+
+ my ($status, $resolution, $see_also) =
delete @params{qw(bug_status resolution see_also)};
# All the bugs are created with everconfirmed = 0.
$params{bug_status} = 'UNCONFIRMED';
my $bug = Bugzilla::Bug->create(\%params);
-
+
# These are necessary for the changedfrom tests.
my $extra_values = $self->_extra_bug_create_values->{$number};
foreach my $field (qw(comments remaining_time percentage_complete
@@ -629,7 +629,7 @@ sub _create_one_bug {
}
$extra_values->{reporter_accessible} = $number == 1 ? 0 : 1;
$extra_values->{cclist_accessible} = $number == 1 ? 0 : 1;
-
+
if ($number == 5) {
# Bypass Bugzilla::Bug--we don't want any changes in bugs_activity
# for bug 5.
@@ -687,7 +687,7 @@ sub _create_one_bug {
# last comment contains all of the important data, like work_time.
$bug->add_comment("1-comment-" . random(100));
}
-
+
my %update_params = %{ $self->_bug_update_values->{$number} };
my %reverse_map = reverse %{ Bugzilla::Bug->FIELD_MAP };
foreach my $db_name (keys %reverse_map) {
@@ -698,14 +698,14 @@ sub _create_one_bug {
$update_params{$update_name} = delete $update_params{$db_name};
}
}
-
- my ($new_status, $new_res) =
+
+ my ($new_status, $new_res) =
delete @update_params{qw(status resolution)};
# Bypass the status workflow.
$bug->{bug_status} = $new_status;
$bug->{resolution} = $new_res;
$bug->{everconfirmed} = 1 if $number == 1;
-
+
# add/remove/set fields.
$update_params{keywords} = { set => $update_params{keywords} };
$update_params{groups} = { add => $update_params{groups},
@@ -721,7 +721,7 @@ sub _create_one_bug {
$update_params{cc} = { add => \@cc_add, remove => \@cc_remove };
my $see_also_remove = $bug->see_also;
my $see_also_add = [$update_params{see_also}];
- $update_params{see_also} = { add => $see_also_add,
+ $update_params{see_also} = { add => $see_also_add,
remove => $see_also_remove };
$update_params{comment} = { body => $update_params{comment} };
$update_params{work_time} = $number;
@@ -740,7 +740,7 @@ sub _create_one_bug {
$timestamp->set(second => $number);
$bug->update($timestamp->ymd . ' ' . $timestamp->hms);
$extra_values->{flags} = $bug->flags;
-
+
# It's not generally safe to do update() multiple times on
# the same Bug object.
$bug = new Bugzilla::Bug($bug->id);
@@ -752,16 +752,16 @@ sub _create_one_bug {
$bug->set_comment_is_private({ $comment_id => 1 });
}
$bug->update($bug->delta_ts);
-
+
my $attach_create = $self->bug_create_value($number, 'attachment');
my $attachment = Bugzilla::Attachment->create({
bug => $bug,
creation_ts => $creation_ts,
%$attach_create });
# Store for the changedfrom tests.
- $extra_values->{attachments} =
+ $extra_values->{attachments} =
[new Bugzilla::Attachment($attachment->id)];
-
+
my $attach_update = $self->bug_update_value($number, 'attachment');
$attachment->set_all($attach_update);
# In order to keep the mimetype on the ispatch attachment,
@@ -771,11 +771,11 @@ sub _create_one_bug {
$attachment->set_flags([], $attach_flags);
$attachment->update($bug->delta_ts);
}
-
+
# Values for changedfrom.
$extra_values->{creation_ts} = $bug->creation_ts;
$extra_values->{delta_ts} = $bug->creation_ts;
-
+
return new Bugzilla::Bug($bug->id);
}
@@ -880,7 +880,7 @@ sub run {
local $SIG{__DIE__} = \&Carp::confess;
$dbh->bz_start_transaction();
-
+
# Some parameters need to be set in order for the tests to function
# properly.
my $everybody = $self->everybody;
@@ -894,7 +894,7 @@ sub run {
local $params->{'insidergroup'} = $everybody->name;
$self->_setup_bugs();
-
+
# Even though _setup_bugs set us as an admin, we want to be sure at
# this point that we have an admin with refreshed group memberships.
Bugzilla->set_user($self->admin);
@@ -935,7 +935,7 @@ sub _setup_bugs {
sub _setup_dependencies {
my ($self) = @_;
my $dbh = Bugzilla->dbh;
-
+
# Set up depedency relationships between the bugs.
# Bug 1 + 6 depend on bug 2 and block bug 3.
my $bug2 = $self->bug(2);
@@ -952,7 +952,7 @@ sub _setup_dependencies {
# searches still work right.
my $set_delta = $dbh->prepare(
'UPDATE bugs SET delta_ts = ? WHERE bug_id = ?');
- foreach my $row ([$original_delta[0], $bug2->id],
+ foreach my $row ([$original_delta[0], $bug2->id],
[$original_delta[1], $bug3->id])
{
$set_delta->execute(@$row);
@@ -982,9 +982,9 @@ sub _set_bug_id_fields {
sub _protect_bug_6 {
my ($self) = @_;
my $dbh = Bugzilla->dbh;
-
+
Bugzilla->set_user($self->admin);
-
+
# Put bug6 in the nobody group.
my $nobody = $self->nobody;
# We pull it newly from the DB to be sure it's safe to call update()
@@ -992,9 +992,9 @@ sub _protect_bug_6 {
my $bug6 = new Bugzilla::Bug($self->bug(6)->id);
$bug6->add_group($nobody);
$bug6->update($bug6->delta_ts);
-
+
# Remove the admin (and everybody else) from the $nobody group.
- $dbh->do('DELETE FROM group_group_map
+ $dbh->do('DELETE FROM group_group_map
WHERE grantor_id = ? OR member_id = ?', undef,
$nobody->id, $nobody->id);
}
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