summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Green <sgreen+mozilla@redhat.com>2012-11-13 07:43:01 +0100
committerByron Jones <bjones@mozilla.com>2012-11-13 07:43:01 +0100
commit718f80eda24c887fa1e31b8142776351db64fe10 (patch)
treef0abbc08ca4a941be5593bdd58a36f16a4bd31a9
parent8ceb5a0bf4540f9c1389bccfc62764f4eee8e5a4 (diff)
downloadbugzilla-718f80eda24c887fa1e31b8142776351db64fe10.tar.gz
bugzilla-718f80eda24c887fa1e31b8142776351db64fe10.tar.xz
Bug 615627: Make t/012throwables.t know about user errors defined in extensions
r=dkl, a=LpSolit
-rw-r--r--extensions/Example/Extension.pm6
-rw-r--r--t/012throwables.t9
-rw-r--r--t/Support/Files.pm8
3 files changed, 20 insertions, 3 deletions
diff --git a/extensions/Example/Extension.pm b/extensions/Example/Extension.pm
index f3efcb2a8..b3b1b299f 100644
--- a/extensions/Example/Extension.pm
+++ b/extensions/Example/Extension.pm
@@ -709,10 +709,12 @@ sub _check_short_desc {
my $invocant = shift;
my $value = $invocant->$original(@_);
if ($value !~ /example/i) {
- # Uncomment this line to make Bugzilla throw an error every time
+ # Use this line to make Bugzilla throw an error every time
# you try to file a bug or update a bug without the word "example"
# in the summary.
- #ThrowUserError('example_short_desc_invalid');
+ if (0) {
+ ThrowUserError('example_short_desc_invalid');
+ }
}
return $value;
}
diff --git a/t/012throwables.t b/t/012throwables.t
index 6cb2688ca..7600cbd02 100644
--- a/t/012throwables.t
+++ b/t/012throwables.t
@@ -47,6 +47,13 @@ foreach my $include_path (@include_paths) {
$file =~ s|\\|/|g if ON_WINDOWS; # convert \ to / in path if on windows
$test_templates{$file} = ()
if $file =~ m#global/(code|user)-error\.html\.tmpl#;
+
+ # Make sure the extension is not disabled
+ if ($file =~ m#^(extensions/[^/]+/)#) {
+ $test_templates{$file} = ()
+ if ! -e "${1}disabled"
+ && $file =~ m#global/(code|user)-error-errors\.html\.tmpl#;
+ }
}
}
@@ -59,7 +66,7 @@ plan tests => $tests;
# Collect all errors defined in templates
foreach my $file (keys %test_templates) {
- $file =~ m|template/([^/]+).*/global/([^/]+)-error\.html\.tmpl|;
+ $file =~ m|template/([^/]+).*/global/([^/]+)-error(?:-errors)?\.html\.tmpl|;
my $lang = $1;
my $errtype = $2;
diff --git a/t/Support/Files.pm b/t/Support/Files.pm
index 24b58c982..1a8e6ee37 100644
--- a/t/Support/Files.pm
+++ b/t/Support/Files.pm
@@ -16,6 +16,14 @@ use File::Find;
find(sub { push(@files, $File::Find::name) if $_ =~ /\.pm$/;}, 'Bugzilla');
push(@files, 'extensions/create.pl');
+my @extensions = glob('extensions/*');
+foreach my $extension (@extensions) {
+ # Skip disabled extensions
+ next if -e "$extension/disabled";
+
+ find(sub { push(@files, $File::Find::name) if $_ =~ /\.pm$/;}, $extension);
+}
+
sub isTestingFile {
my ($file) = @_;
my $exclude;