Skip to content

Commit

Permalink
More minor test suite cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
dklawren committed Nov 20, 2024
1 parent a3fa103 commit b7f4513
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 11 deletions.
12 changes: 5 additions & 7 deletions Bugzilla/Config.pm
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,13 @@ sub update {
{
if ($old_value ne $new_value) {
$dbh->do('UPDATE params SET value = ? WHERE name = ?', undef, $new_value, $key);
$changes{"$id:$key"} = [$old_value, $new_value];
$changes{$key} = [$old_value, $new_value];
}
}
else {
$dbh->do('INSERT INTO params (name, value) VALUES (?, ?)',
undef, $key, $new_value);
$changes{"$id:$key"} = ['', $new_value];
$changes{$key} = ['', $new_value];
}
}

Expand All @@ -132,10 +132,8 @@ sub update {
# not the case here so we assign the 'id' variable each interation
# to make audit_log think each is a separate instance of
# Bugzilla::Config and each change is a separate transaction.
foreach my $item (keys %changes) {
my ($id, $key) = split /:/, $item;
$self->{id} = $id;
$self->audit_log({$key => [$changes{$item}->[0], $changes{$item}->[1]]});
foreach my $key (keys %changes) {
$self->audit_log({$key => [$changes{$key}->[0], $changes{$key}->[1]]});
}
}
catch {
Expand Down Expand Up @@ -301,7 +299,7 @@ sub migrate_params {
}

# Generate unique Duo integration secret key
if ($param->{duo_akey} eq '') {
if (!exists $param->{duo_akey} || $param->{duo_akey} eq '') {
require Bugzilla::Util;
$param->{duo_akey} = Bugzilla::Util::generate_random_password(40);
}
Expand Down
2 changes: 1 addition & 1 deletion Bugzilla/DB/Schema/Mysql.pm
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ sub _get_create_index_ddl {

my $sql = "CREATE ";
$sql .= "$index_type "
if ($index_type eq 'UNIQUE' || $index_type eq 'FULLTEXT');
if ($index_type && ($index_type eq 'UNIQUE' || $index_type eq 'FULLTEXT'));
$sql
.= "INDEX "
. $dbh->quote_identifier($index_name) . " ON "
Expand Down
2 changes: 1 addition & 1 deletion extensions/BMO/Extension.pm
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ sub parse_bounty_attachment_description {
fixed_date => $+{fixed_date} // '',
awarded_date => $+{awarded_date} // '',
publish => $map{$+{publish} // 'false'},
credit => [grep {$_} split(/\s*,\s*/, $+{credits})]
credit => [grep {$_} split(/\s*,\s*/, $+{credits} || '')]
};
}

Expand Down
2 changes: 1 addition & 1 deletion t/hash-sig.t
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use Bugzilla::Util qw(generate_random_password);
use Bugzilla::Token qw(issue_hash_sig check_hash_sig);
use Bugzilla::Localconfig;
use Test2::V0;
use Test2::Mock qw(mock);
use Test2::Tools::Mock qw(mock);

my $site_wide_secret = generate_random_password(256);
my $Localconfig = mock 'Bugzilla::Localconfig' => (
Expand Down
2 changes: 1 addition & 1 deletion t/mojo-example.t
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ my $api_key = issue_api_key('[email protected]')->api_key;
my $t = Test::Mojo->new('Bugzilla::App');

# we ensure this file exists so the /__lbhearbeat__ test passes.
$t->app->home->child('__lbheartbeat__')->spurt('httpd OK');
$t->app->home->child('__lbheartbeat__')->spew('httpd OK');

# Method chaining is used extensively.
$t->get_ok('/__lbheartbeat__')->status_is(200)->content_is('httpd OK');
Expand Down
2 changes: 2 additions & 0 deletions template/en/default/bug/process/bugmail.html.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
[% USE Bugzilla %]
[% PROCESS global/variables.none.tmpl %]

[% recipient_count = 0 IF !recipient_count.defined %]

[% IF recipient_count > 1 %]
Email sent to [% recipient_count FILTER none %] recipients.
[% ELSIF recipient_count == 1 %]
Expand Down

0 comments on commit b7f4513

Please sign in to comment.