]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 615627: Make t/012throwables.t know about user errors defined in extensions
authorSimon Green <sgreen+mozilla@redhat.com>
Tue, 13 Nov 2012 06:43:01 +0000 (14:43 +0800)
committerByron Jones <bjones@mozilla.com>
Tue, 13 Nov 2012 06:43:01 +0000 (14:43 +0800)
r=dkl, a=LpSolit

extensions/Example/Extension.pm
t/012throwables.t
t/Support/Files.pm

index f3efcb2a860318a1a421154ae94e868152352ed8..b3b1b299f86e2b45edbbd53ce64e340909dce6bd 100644 (file)
@@ -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;
 }
index 6cb2688cad6c5bb2a8f0cbcd9f7392a41cfad897..7600cbd02fcd0cfb92132b54a8599e5ccfb5942d 100644 (file)
@@ -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;
 
index 24b58c982a194bb8008a1b49121ac22f2e972fd5..1a8e6ee371bcdc3e67dad6d14d476e1678c19987 100644 (file)
@@ -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;