]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 663835 - Extensions templates are not tested by the normal sanity test scripts
authorDavid Lawrence <dlawrence@mozilla.com>
Thu, 23 Jun 2011 18:43:18 +0000 (14:43 -0400)
committerDavid Lawrence <dlawrence@mozilla.com>
Thu, 23 Jun 2011 18:43:18 +0000 (14:43 -0400)
r/a=mkanat

t/004template.t
t/Support/Templates.pm

index 31ce7927ca7c8b357f1312561c5e01401768e344..d38ae37e260e09173a443d83394864007326cb9a 100644 (file)
@@ -66,16 +66,13 @@ sub existOnce {
 # Check to make sure all templates that are referenced in
 # Bugzilla exist in the proper place.
 
-foreach my $lang (@languages) {
-    foreach my $file (@referenced_files) {
-        my @path = map(File::Spec->catfile($_, $file),
-                       split(':', $include_path{$lang} . ":" . $include_path{"en"}));
-        if (my $path = existOnce(@path)) {
-            ok(1, "$path exists");
-        } else {
-            ok(0, "$file cannot be located --ERROR");
-            print $fh "Looked in:\n  " . join("\n  ", @path) . "\n";
-        }
+foreach my $file (@referenced_files) {
+    my @path = map(File::Spec->catfile($_, $file), @include_paths);
+    if (my $path = existOnce(@path)) {
+        ok(1, "$path exists");
+    } else {
+        ok(0, "$file cannot be located --ERROR");
+        print $fh "Looked in:\n  " . join("\n  ", @path) . "\n";
     }
 }
 
index 40e16f1053e8e7e3095fba1bbdcbff17b4f72a20..90b63a72694ac117d42d926982effd3835ed6438 100644 (file)
@@ -34,6 +34,8 @@ use base qw(Exporter);
 use vars qw(@languages @include_paths %include_path @referenced_files 
             %actual_files $num_actual_files);
 
+use Bugzilla;
+use Bugzilla::Install::Util qw(template_include_path);
 use Support::Files;
 
 use File::Find;
@@ -57,30 +59,9 @@ use File::Spec;
 # total number of actual_files
 $num_actual_files = 0;
 
-# Scan for the template available languages and include paths
-{
-    opendir(DIR, "template") || die "Can't open  'template': $!";
-    my @files = grep { /^[a-z-]+$/i } readdir(DIR);
-    closedir DIR;
-
-    foreach my $langdir (@files) {
-        next if($langdir =~ /^CVS$/i);
-
-        my $path = File::Spec->catdir('template', $langdir, 'custom');
-        my @dirs = ();
-        push(@dirs, $path) if(-d $path);
-        $path = File::Spec->catdir('template', $langdir, 'extension');
-        push(@dirs, $path) if(-d $path);
-        $path = File::Spec->catdir('template', $langdir, 'default');
-        push(@dirs, $path) if(-d $path);
-
-        next if(scalar(@dirs) == 0);
-        push(@languages, $langdir);
-        push(@include_paths, @dirs);
-        $include_path{$langdir} = join(":",@dirs);
-    }
-}
-
+# Set the template available languages and include paths
+@languages = @{ Bugzilla->languages };
+@include_paths = @{ template_include_path({ language => Bugzilla->languages }) };
 
 my @files;