merged with SVN to get friends stuff
This commit is contained in:
commit
7e12c6c2f0
73 changed files with 3262 additions and 424 deletions
|
|
@ -14,7 +14,10 @@ use lib "$FindBin::Bin/../../lib";
|
|||
|
||||
use Test::MockObject;
|
||||
my $mocker = Test::MockObject->new();
|
||||
$mocker->fake_module('WebGUI::Form::Image');
|
||||
#$mocker->fake_module('WebGUI::Form::Image', fake_method => sub {return 1;});
|
||||
# XXX
|
||||
# Hack to make this test run. This exact same code works fine for File.t above
|
||||
$mocker->fake_module('WebGUI::Form::Image', fake_method => sub {return 1;});
|
||||
$mocker->fake_new('WebGUI::Form::Image');
|
||||
|
||||
use WebGUI::Test;
|
||||
|
|
|
|||
|
|
@ -15,12 +15,14 @@ use lib "$FindBin::Bin/../lib";
|
|||
use WebGUI::Test;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::Asset::Template;
|
||||
use Test::More tests => 8; # increment this value for each test you create
|
||||
use Test::More tests => 10; # increment this value for each test you create
|
||||
use Test::Deep;
|
||||
|
||||
my $session = WebGUI::Test->session;
|
||||
|
||||
my $list = WebGUI::Asset::Template->getList($session);
|
||||
ok(defined $list, "getList()");
|
||||
cmp_deeply($list, {}, 'getList with no classname returns an empty hashref');
|
||||
|
||||
my $template = " <tmpl_var variable> <tmpl_if conditional>true</tmpl_if> <tmpl_loop loop>XY</tmpl_loop> ";
|
||||
my %var = (
|
||||
variable=>"AAAAA",
|
||||
|
|
@ -31,11 +33,22 @@ my $output = WebGUI::Asset::Template->processRaw($session,$template,\%var);
|
|||
ok($output =~ m/\bAAAAA\b/, "processRaw() - variables");
|
||||
ok($output =~ m/true/, "processRaw() - conditionals");
|
||||
ok($output =~ m/\s(?:XY){5}\s/, "processRaw() - loops");
|
||||
|
||||
my $importNode = WebGUI::Asset::Template->getImportNode($session);
|
||||
my $template = $importNode->addChild({className=>"WebGUI::Asset::Template", title=>"test", url=>"testingtemplates", template=>$template});
|
||||
ok(defined $template, "creating a template");
|
||||
my $template = $importNode->addChild({className=>"WebGUI::Asset::Template", title=>"test", url=>"testingtemplates", template=>$template, namespace=>'WebGUI Test Template'});
|
||||
isa_ok($template, 'WebGUI::Asset::Template', "creating a template");
|
||||
|
||||
$var{variable} = "BBBBB";
|
||||
$output = $template->process(\%var);
|
||||
ok($output =~ m/\bAAAAA\b/, "process() - variables");
|
||||
ok($output =~ m/\bBBBBB\b/, "process() - variables");
|
||||
ok($output =~ m/true/, "process() - conditionals");
|
||||
ok($output =~ m/\s(?:XY){5}\s/, "process() - loops");
|
||||
|
||||
my $newList = WebGUI::Asset::Template->getList($session, 'WebGUI Test Template');
|
||||
ok(exists $newList->{$template->getId}, 'Uncommitted template exists returned from getList');
|
||||
|
||||
my $newList2 = WebGUI::Asset::Template->getList($session, 'WebGUI Test Template', "assetData.status='approved'");
|
||||
ok(!exists $newList2->{$template->getId}, 'extra clause to getList prevents uncommitted template from being displayed');
|
||||
|
||||
$template->purge;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue