File: basic.t

package info (click to toggle)
libcgi-application-perl 4.50-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 688 kB
  • sloc: perl: 1,368; sh: 38; makefile: 7
file content (36 lines) | stat: -rw-r--r-- 734 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36

package foo;

use base CGI::Application;
use CGI::Application::Plugin::ErrorPage 'error';

no warnings 'redefine';
sub error {
     my $c = shift;
     return $c->CGI::Application::Plugin::ErrorPage::error(
         tmpl => \'Surprise! <tmpl_var title> <tmpl_var msg>',
         @_,
     );
}


package main;
use Test::More 'no_plan';

$ENV{CGI_APP_RETURN_ONLY} = 1;

use CGI;
my $q = CGI->new;
$q->param('rm' => 'missing'); 
my $foo = foo->new( QUERY => $q );

is( 
    $foo->error( title => 'Technical Failure', msg   => 'BOOM!'),
    'Surprise! Technical Failure BOOM!',
);

like(
    $foo->run,
    qr/\QSurprise! The requested page was not found. (The page tried was: missing)/,
    "testing AUTOLOAD default functionality" 
);