X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=trunk%2Ft%2Flib%2FTestApp.pm;h=97bf8f004f962b5dd0c301ec2acd1ef72b801cb3;hb=08e0f7041d91aac10f15e17d5e67f61ad48102a4;hp=bfd216dcef247ab9690362c806174b7bb58b76a5;hpb=0deea661d435742e001df024796ef6e4a861a2c6;p=catagits%2FCatalyst-View-TT.git diff --git a/trunk/t/lib/TestApp.pm b/trunk/t/lib/TestApp.pm index bfd216d..97bf8f0 100755 --- a/trunk/t/lib/TestApp.pm +++ b/trunk/t/lib/TestApp.pm @@ -21,64 +21,3 @@ __PACKAGE__->config( __PACKAGE__->setup; -sub default : Private { - my ($self, $c) = @_; - - $c->response->redirect($c->uri_for('test')); -} - -sub test : Local { - my ($self, $c) = @_; - - $c->stash->{message} = ($c->request->param('message') || $c->config->{default_message}); -} - -sub test_includepath : Local { - my ($self, $c) = @_; - $c->stash->{message} = ($c->request->param('message') || $c->config->{default_message}); - $c->stash->{template} = $c->request->param('template'); - if ( $c->request->param('additionalpath') ){ - my $additionalpath = Path::Class::dir($c->config->{root}, $c->request->param('additionalpath')); - $c->stash->{additional_template_paths} = ["$additionalpath"]; - } - if ( $c->request->param('addpath') ){ - my $additionalpath = Path::Class::dir($c->config->{root}, $c->request->param('addpath')); - my $view = 'TestApp::View::TT::' . ($c->request->param('view') || $c->config->{default_view}); - no strict "refs"; - push @{$view . '::include_path'}, "$additionalpath"; - use strict; - } -} - -sub test_render : Local { - my ($self, $c) = @_; - - my $out = $c->stash->{message} = $c->view('TT::Appconfig')->render($c, $c->req->param('template'), {param => $c->req->param('param') || ''}); - if (UNIVERSAL::isa($out, 'Template::Exception')) { - $c->response->body($out); - $c->response->status(403); - } else { - $c->stash->{template} = 'test.tt'; - } - -} - -sub test_msg : Local { - my ($self, $c) = @_; - my $tmpl = $c->req->param('msg'); - - $c->stash->{message} = $c->view('TT::AppConfig')->render($c, \$tmpl); - $c->stash->{template} = 'test.tt'; -} - -sub end : Private { - my ($self, $c) = @_; - - return 1 if $c->response->status =~ /^3\d\d$/; - return 1 if $c->response->body; - - my $view = 'View::TT::' . ($c->request->param('view') || $c->config->{default_view}); - $c->forward($view); -} - -1;