Test for checking syntax in all templates.
This commit is contained in:
parent
7a439fd702
commit
3fb3644389
1 changed files with 48 additions and 0 deletions
48
t/templateSyntax.t
Normal file
48
t/templateSyntax.t
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001-2009 Plain Black Corporation.
|
||||
#-------------------------------------------------------------------
|
||||
# Please read the legal notices (docs/legal.txt) and the license
|
||||
# (docs/license.txt) that came with this distribution before using
|
||||
# this software.
|
||||
#-------------------------------------------------------------------
|
||||
# http://www.plainblack.com info@plainblack.com
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
use FindBin;
|
||||
use strict;
|
||||
use warnings;
|
||||
use lib "$FindBin::Bin/lib"; ##t/lib
|
||||
|
||||
use WebGUI::Test;
|
||||
use WebGUI::Session;
|
||||
use Data::Dumper;
|
||||
use WebGUI::Asset::Template;
|
||||
|
||||
#The goal of this test is to locate poorly used macros in the default
|
||||
#templates;
|
||||
|
||||
use Test::More; # increment this value for each test you create
|
||||
my $numTests = 0;
|
||||
|
||||
my $session = WebGUI::Test->session;
|
||||
my $lib = WebGUI::Test->lib;
|
||||
|
||||
# put your tests here
|
||||
|
||||
$numTests = $session->db->quickScalar('select count(distinct(assetId)) from template');
|
||||
|
||||
plan tests => $numTests;
|
||||
|
||||
my $getATemplate = WebGUI::Asset::Template->getIsa($session);
|
||||
|
||||
while (my $templateAsset = $getATemplate->()) {
|
||||
my $output = $templateAsset->process({});
|
||||
unlike(
|
||||
$output,
|
||||
qr/\AError processing template:/,
|
||||
sprintf "%s: %s (%s) has no syntax errors",
|
||||
$templateAsset->getTitle, $templateAsset->getId, $templateAsset->getUrl
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue