diff options
author | Max Kanat-Alexander <mkanat@bugzilla.org> | 2010-07-07 23:34:25 +0200 |
---|---|---|
committer | Max Kanat-Alexander <mkanat@bugzilla.org> | 2010-07-07 23:34:25 +0200 |
commit | 87ea46f7fa2b269f065181f7765352184bb59717 (patch) | |
tree | 20e37379d319535c954480e86765a580342118bd /Bugzilla | |
parent | 814b24fdc9407a741967322041ff817665f8e00b (diff) | |
download | bugzilla-87ea46f7fa2b269f065181f7765352184bb59717.tar.gz bugzilla-87ea46f7fa2b269f065181f7765352184bb59717.tar.xz |
Bug 574879: Create a test that assures the correctness of Search.pm's
boolean charts
r=glob, a=mkanat
Diffstat (limited to 'Bugzilla')
-rw-r--r-- | Bugzilla/Bug.pm | 11 | ||||
-rw-r--r-- | Bugzilla/Constants.pm | 4 | ||||
-rw-r--r-- | Bugzilla/Error.pm | 7 | ||||
-rw-r--r-- | Bugzilla/Install.pm | 4 | ||||
-rw-r--r-- | Bugzilla/Install/Filesystem.pm | 4 | ||||
-rw-r--r-- | Bugzilla/Search.pm | 2 |
6 files changed, 30 insertions, 2 deletions
diff --git a/Bugzilla/Bug.pm b/Bugzilla/Bug.pm index ed302a053..e32add2e1 100644 --- a/Bugzilla/Bug.pm +++ b/Bugzilla/Bug.pm @@ -3203,6 +3203,17 @@ sub comments { return \@comments; } +# This is needed by xt/search.t. +sub percentage_complete { + my $self = shift; + return undef if $self->{'error'} || !Bugzilla->user->is_timetracker; + my $remaining = $self->remaining_time; + my $actual = $self->actual_time; + my $total = $remaining + $actual; + return undef if $total == 0; + return 100 * ($actual / $total); +} + sub product { my ($self) = @_; return $self->{product} if exists $self->{product}; diff --git a/Bugzilla/Constants.pm b/Bugzilla/Constants.pm index 4d9b1edc3..63219833e 100644 --- a/Bugzilla/Constants.pm +++ b/Bugzilla/Constants.pm @@ -141,11 +141,13 @@ use File::Basename; USAGE_MODE_XMLRPC USAGE_MODE_EMAIL USAGE_MODE_JSON + USAGE_MODE_TEST ERROR_MODE_WEBPAGE ERROR_MODE_DIE ERROR_MODE_DIE_SOAP_FAULT ERROR_MODE_JSON_RPC + ERROR_MODE_TEST COLOR_ERROR @@ -457,6 +459,7 @@ use constant USAGE_MODE_CMDLINE => 1; use constant USAGE_MODE_XMLRPC => 2; use constant USAGE_MODE_EMAIL => 3; use constant USAGE_MODE_JSON => 4; +use constant USAGE_MODE_TEST => 5; # Error modes. Default set by Bugzilla->usage_mode (so ERROR_MODE_WEBPAGE # usually). Use with Bugzilla->error_mode. @@ -464,6 +467,7 @@ use constant ERROR_MODE_WEBPAGE => 0; use constant ERROR_MODE_DIE => 1; use constant ERROR_MODE_DIE_SOAP_FAULT => 2; use constant ERROR_MODE_JSON_RPC => 3; +use constant ERROR_MODE_TEST => 4; # The ANSI colors of messages that command-line scripts use use constant COLOR_ERROR => 'red'; diff --git a/Bugzilla/Error.pm b/Bugzilla/Error.pm index 60e7837de..649fdd486 100644 --- a/Bugzilla/Error.pm +++ b/Bugzilla/Error.pm @@ -33,6 +33,7 @@ use Bugzilla::WebService::Constants; use Bugzilla::Util; use Carp; +use Data::Dumper; use Date::Format; # We cannot use $^S to detect if we are in an eval(), because mod_perl @@ -102,6 +103,12 @@ sub _throw_error { $template->process($name, $vars) || ThrowTemplateError($template->error()); } + # There are some tests that throw and catch a lot of errors, + # and calling $template->process over and over for those errors + # is too slow. So instead, we just "die" with a dump of the arguments. + elsif (Bugzilla->error_mode == ERROR_MODE_TEST) { + die Dumper($vars); + } else { my $message; $template->process($name, $vars, \$message) diff --git a/Bugzilla/Install.pm b/Bugzilla/Install.pm index 3754c0787..9536f4645 100644 --- a/Bugzilla/Install.pm +++ b/Bugzilla/Install.pm @@ -358,7 +358,9 @@ sub make_admin { write_params(); } - print "\n", get_text('install_admin_created', { user => $user }), "\n"; + if (Bugzilla->usage_mode == USAGE_MODE_CMDLINE) { + print "\n", get_text('install_admin_created', { user => $user }), "\n"; + } } sub _prompt_for_password { diff --git a/Bugzilla/Install/Filesystem.pm b/Bugzilla/Install/Filesystem.pm index 0ca49a75c..db55576a4 100644 --- a/Bugzilla/Install/Filesystem.pm +++ b/Bugzilla/Install/Filesystem.pm @@ -241,6 +241,8 @@ sub FILESYSTEM { dirs => DIR_OWNER_WRITE }, t => { files => OWNER_WRITE, dirs => DIR_OWNER_WRITE }, + xt => { files => OWNER_WRITE, + dirs => DIR_OWNER_WRITE }, 'docs/lib' => { files => OWNER_WRITE, dirs => DIR_OWNER_WRITE }, 'docs/*/xml' => { files => OWNER_WRITE, @@ -333,6 +335,8 @@ EOT contents => HT_DEFAULT_DENY }, 't/.htaccess' => { perms => WS_SERVE, contents => HT_DEFAULT_DENY }, + 'xt/.htaccess' => { perms => WS_SERVE, + contents => HT_DEFAULT_DENY }, "$datadir/.htaccess" => { perms => WS_SERVE, contents => HT_DEFAULT_DENY }, diff --git a/Bugzilla/Search.pm b/Bugzilla/Search.pm index ad8ab0edb..89e2dfa61 100644 --- a/Bugzilla/Search.pm +++ b/Bugzilla/Search.pm @@ -2159,7 +2159,7 @@ sub _owner_idle_time_greater_less { my $table = "idle_" . $$chartid; $$v =~ /^(\d+)\s*([hHdDwWmMyY])?$/; - my $quantity = $1; + my $quantity = $1 || 0; my $unit = lc $2; my $unitinterval = 'DAY'; if ($unit eq 'h') { |