diff options
author | tetragon <tetragon@4979c152-3d1c-0410-bac9-87ea11338e46> | 2007-06-01 14:13:33 +0000 |
---|---|---|
committer | tetragon <tetragon@4979c152-3d1c-0410-bac9-87ea11338e46> | 2007-06-01 14:13:33 +0000 |
commit | 5deb0455ef5b5a2ffe8cbe26a75cdd07e8788ded (patch) | |
tree | 2f1ff13c7c66bb7a4449fbe1cd0d30b24fc15187 /t | |
parent | 131a6de0170f0e79cc27cc77e972487ca9c5c33f (diff) |
Templating updates for output handling
git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@1248 4979c152-3d1c-0410-bac9-87ea11338e46
Diffstat (limited to 't')
-rw-r--r-- | t/04-template-handling.t | 42 |
1 files changed, 40 insertions, 2 deletions
diff --git a/t/04-template-handling.t b/t/04-template-handling.t index 04048b10..0e2f52bb 100644 --- a/t/04-template-handling.t +++ b/t/04-template-handling.t @@ -3,13 +3,14 @@ use strict; use warnings; -$ENV{TMPDIR} = 't/var'; +#$ENV{TMPDIR} = 't/var'; +$ENV{TMPDIR} = '/Users/seneca/sourceforge-svn/ledger-smb/trunk/t/var'; use Test::More 'no_plan'; use Test::Trap qw(trap $trap); use Test::Exception; -use Error qw(:try); +use Error qw(:try :warndie); use LedgerSMB::AM; use LedgerSMB::Form; @@ -212,3 +213,40 @@ ok(defined $template, 'Template, new: Object creation with non-existent format'); throws_ok{$template->render({'login' => 'foo'})} qr/Can't locate/, 'Template, render: Invalid format caught'; + +$template = undef; +$template = new LedgerSMB::Template('user' => $myconfig, 'format' => 'PDF', + 'template' => '04-template'); +ok(defined $template, + 'Template, new: Object creation with format and template'); +isa_ok($template, 'LedgerSMB::Template', + 'Template, new: Object creation with format and template'); +is($template->{include_path}, 't/data', + 'Template, new: Object creation with format and template'); +is($template->render({'login' => 'foo\&bar'}), 't/var/04-template-output.pdf', + 'Template, render: Simple PDF template, default filename'); +ok(-e 't/var/04-template-output.pdf', 'Template, render (PDF): File created'); + +$template = undef; +$template = new LedgerSMB::Template('user' => $myconfig, 'format' => 'PS', + 'template' => '04-template'); +ok(defined $template, + 'Template, new: Object creation with format and template'); +isa_ok($template, 'LedgerSMB::Template', + 'Template, new: Object creation with format and template'); +is($template->{include_path}, 't/data', + 'Template, new: Object creation with format and template'); +is($template->render({'login' => 'foo\&bar'}), 't/var/04-template-output.ps', + 'Template, render: Simple Postscript template, default filename'); +ok(-e 't/var/04-template-output.ps', 'Template, render (PS): File created'); +##open($FH, '<', 't/var/04-template-output.html'); +##@r = <$FH>; +##close($FH); +##chomp(@r); +##is(join("\n", @r), "I am a template.\nLook at me foo&bar.", +## 'Template, render (HTML): Simple HTML template, correct output'); +##is(unlink('t/var/04-template-output.html'), 1, +## 'Template, render: removing testfile'); +##ok(!-e 't/var/04-template-output.html', +## 'Template, render (HTML): testfile removed'); + |