diff options
author | Perl Tidy <perltidy@bugzilla.org> | 2018-12-05 21:38:52 +0100 |
---|---|---|
committer | Dylan William Hardison <dylan@hardison.net> | 2018-12-05 23:49:08 +0100 |
commit | 8ec8da0491ad89604700b3e29a227966f6d84ba1 (patch) | |
tree | 9d270f173330ca19700e0ba9f2ee931300646de1 /xt/lib/Bugzilla/Test/Search/InjectionTest.pm | |
parent | a7bb5a65b71644d9efce5fed783ed545b9336548 (diff) | |
download | bugzilla-8ec8da0491ad89604700b3e29a227966f6d84ba1.tar.gz bugzilla-8ec8da0491ad89604700b3e29a227966f6d84ba1.tar.xz |
no bug - reformat all the code using the new perltidy rules
Diffstat (limited to 'xt/lib/Bugzilla/Test/Search/InjectionTest.pm')
-rw-r--r-- | xt/lib/Bugzilla/Test/Search/InjectionTest.pm | 82 |
1 files changed, 42 insertions, 40 deletions
diff --git a/xt/lib/Bugzilla/Test/Search/InjectionTest.pm b/xt/lib/Bugzilla/Test/Search/InjectionTest.pm index 41f5fcdc2..d4654b972 100644 --- a/xt/lib/Bugzilla/Test/Search/InjectionTest.pm +++ b/xt/lib/Bugzilla/Test/Search/InjectionTest.pm @@ -32,60 +32,62 @@ use Test::Exception; sub num_tests { return NUM_SEARCH_TESTS } sub _known_broken { - my ($self) = @_; - my $operator_broken = INJECTION_BROKEN_OPERATOR->{$self->operator}; - # We don't want to auto-vivify $operator_broken and thus make it true. - my @field_ok = $operator_broken ? @{ $operator_broken->{field_ok} || [] } - : (); - $operator_broken = undef if grep { $_ eq $self->field } @field_ok; - - my $field_broken = INJECTION_BROKEN_FIELD->{$self->field} - || INJECTION_BROKEN_FIELD->{$self->field_object->type}; - # We don't want to auto-vivify $field_broken and thus make it true. - my @operator_ok = $field_broken ? @{ $field_broken->{operator_ok} || [] } - : (); - $field_broken = undef if grep { $_ eq $self->operator } @operator_ok; - - return $operator_broken || $field_broken || {}; + my ($self) = @_; + my $operator_broken = INJECTION_BROKEN_OPERATOR->{$self->operator}; + + # We don't want to auto-vivify $operator_broken and thus make it true. + my @field_ok = $operator_broken ? @{$operator_broken->{field_ok} || []} : (); + $operator_broken = undef if grep { $_ eq $self->field } @field_ok; + + my $field_broken = INJECTION_BROKEN_FIELD->{$self->field} + || INJECTION_BROKEN_FIELD->{$self->field_object->type}; + + # We don't want to auto-vivify $field_broken and thus make it true. + my @operator_ok = $field_broken ? @{$field_broken->{operator_ok} || []} : (); + $field_broken = undef if grep { $_ eq $self->operator } @operator_ok; + + return $operator_broken || $field_broken || {}; } sub sql_error_ok { return $_[0]->_known_broken->{sql_error} } # Injection tests only skip fields on certain dbs. sub field_not_yet_implemented { - my ($self) = @_; - # We use the constant directly because we don't want operator_ok - # or field_ok to stop us. - my $broken = INJECTION_BROKEN_FIELD->{$self->field} - || INJECTION_BROKEN_FIELD->{$self->field_object->type}; - my $skip_for_dbs = $broken->{db_skip}; - return undef if !$skip_for_dbs; - my $dbh = Bugzilla->dbh; - if (my ($skip) = grep { $dbh->isa("Bugzilla::DB::$_") } @$skip_for_dbs) { - my $field = $self->field; - return "$field injection testing is not supported with $skip"; - } - return undef; + my ($self) = @_; + + # We use the constant directly because we don't want operator_ok + # or field_ok to stop us. + my $broken = INJECTION_BROKEN_FIELD->{$self->field} + || INJECTION_BROKEN_FIELD->{$self->field_object->type}; + my $skip_for_dbs = $broken->{db_skip}; + return undef if !$skip_for_dbs; + my $dbh = Bugzilla->dbh; + if (my ($skip) = grep { $dbh->isa("Bugzilla::DB::$_") } @$skip_for_dbs) { + my $field = $self->field; + return "$field injection testing is not supported with $skip"; + } + return undef; } + # Injection tests don't do translation. sub translated_value { $_[0]->test_value } sub name { return "injection-" . $_[0]->SUPER::name; } # Injection tests don't check content. -sub _test_content {} +sub _test_content { } sub _test_sql { - my $self = shift; - my ($sql) = @_; - my $dbh = Bugzilla->dbh; - my $name = $self->name; - if (my $error_ok = $self->sql_error_ok) { - throws_ok { $dbh->selectall_arrayref($sql) } $error_ok, - "$name: SQL query dies, as we expect"; - return; - } - return $self->SUPER::_test_sql(@_); + my $self = shift; + my ($sql) = @_; + my $dbh = Bugzilla->dbh; + my $name = $self->name; + if (my $error_ok = $self->sql_error_ok) { + throws_ok { $dbh->selectall_arrayref($sql) } $error_ok, + "$name: SQL query dies, as we expect"; + return; + } + return $self->SUPER::_test_sql(@_); } -1;
\ No newline at end of file +1; |