From 2d351f468f57124a87f504f29bfe58ca185e7c1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Demians?= Date: Thu, 21 Jul 2011 10:18:29 +0200 Subject: [PATCH] Bug 6458 Template Toolkit files test case This test validate Template Toolkit (TT) Koha files. For the time being an unique validation is done: Test if TT files contain TT directive within HTML tag. For example: 1; +use File::Find; +use Cwd; + + +my @files_with_directive_in_tag = do { + my @files; + find( sub { + my $dir = getcwd(); + return if $dir =~ /blib/; + return unless /\.(tt)$/; + open my $fh, "<", $_; + my $name = $_; + my $line = 1; + my @lines; + while ( <$fh> ) { + push @lines, $line if /<([a-z]*)\s*\[/i; + $line++; + } + ($dir) = $dir =~ /koha-tmpl\/(.*)$/; + push @files, { name => "$dir/$name", lines => \@lines } if @lines; + }, ( './koha-tmpl/opac-tmpl/prog/en', './koha-tmpl/intranet-tmpl/prog/en' ) ); + @files; +}; + + +ok( !@files_with_directive_in_tag, "TT syntax: not using TT directive within HTML tag" ) + or diag( "Files list: \n", + join( "\n", map {$_->{name} . ': ' . join(', ', @{$_->{lines}}) + } @files_with_directive_in_tag ) ); + + + +=head1 NAME + +tt_valid.t + +=head1 DESCRIPTION + +This test validate Template Toolkit (TT) Koha files. + +For the time being an unique validation is done: Test if TT files contain TT +directive within HTML tag. For example: + +