Fridolin Somers
8bc2fb4df6
valid-templates.t actually tests the templates and includes of only the "prog" theme at opac and intranet. It does not test the opac templates and includes of bootstrap theme, nor ccsr. This is critical since this test is used for patch integrations in release maintenance. This patch adds the test of bootstrap opac theme. I did not manage to add the ccsr theme since it is not a real theme, meaning it has no templates and not all includes. Test by runnning perl xt/author/valid-templates.t and looking at the logs. Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> Now there are 902 lines, bootstrap tested (1 error detected!) No koha-qa errors Signed-off-by: Galen Charlton <gmc@esilibrary.com>
97 lines
2.4 KiB
Perl
97 lines
2.4 KiB
Perl
#!/usr/bin/perl
|
|
|
|
# Copyright 2011 Catalyst IT
|
|
#
|
|
# This file is part of Koha.
|
|
#
|
|
# Koha is free software; you can redistribute it and/or modify it under the
|
|
# terms of the GNU General Public License as published by the Free Software
|
|
# Foundation; either version 2 of the License, or (at your option) any later
|
|
# version.
|
|
#
|
|
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
|
# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License along
|
|
# with Koha; if not, write to the Free Software Foundation, Inc.,
|
|
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
use strict;
|
|
use warnings;
|
|
|
|
=head1 NAME
|
|
|
|
valid-templates.t
|
|
|
|
=head1 DESCRIPTION
|
|
|
|
This test checks all staff and OPAC templates and includes for syntax errors
|
|
|
|
=cut
|
|
|
|
|
|
use File::Find;
|
|
use File::Spec;
|
|
use Template;
|
|
use Test::More;
|
|
# use FindBin;
|
|
# use IPC::Open3;
|
|
|
|
print "Testing intranet prog templates\n";
|
|
run_template_test(
|
|
'koha-tmpl/intranet-tmpl/prog/en/modules',
|
|
'koha-tmpl/intranet-tmpl/prog/en/includes'
|
|
);
|
|
|
|
print "Testing opac bootstrap templates\n";
|
|
run_template_test(
|
|
'koha-tmpl/opac-tmpl/bootstrap/en/modules',
|
|
'koha-tmpl/opac-tmpl/bootstrap/en/includes'
|
|
);
|
|
|
|
print "Testing opac prog templates\n";
|
|
run_template_test(
|
|
'koha-tmpl/opac-tmpl/prog/en/modules',
|
|
'koha-tmpl/opac-tmpl/prog/en/includes'
|
|
);
|
|
|
|
# TODO add test of opac ccsr templates
|
|
|
|
done_testing();
|
|
|
|
sub run_template_test {
|
|
my $template_path = shift;
|
|
my $include_path = shift;
|
|
my $template_dir = File::Spec->rel2abs($template_path);
|
|
my $include_dir = File::Spec->rel2abs($include_path);
|
|
my $template_test = create_template_test($include_dir);
|
|
find( { wanted => $template_test, no_chdir => 1 },
|
|
$template_dir, $include_dir );
|
|
}
|
|
|
|
sub create_template_test {
|
|
my $includes = shift;
|
|
return sub {
|
|
my $tt = Template->new(
|
|
{
|
|
ABSOLUTE => 1,
|
|
INCLUDE_PATH => $includes,
|
|
PLUGIN_BASE => 'Koha::Template::Plugin',
|
|
}
|
|
);
|
|
my $vars;
|
|
my $output;
|
|
if ( !ok( $tt->process( $_, $vars, \$output ), $_ ) ) {
|
|
diag( $tt->error );
|
|
}
|
|
}
|
|
}
|
|
|
|
=head1 AUTHOR
|
|
|
|
Koha Developement Team <http://koha-community.org>
|
|
|
|
Chris Cormack <chrisc@catalyst.net.nz>
|
|
|
|
=cut
|