Debian Codegraph @

t/postrun.t

raw symbols SCIP
1 use Test::Morescip-perl cpan CGI-Application 4.61 Test/More/ tests=>7;
2
3 # Include the test hierarchy
4 use libscip-perl cpan CGI-Application 4.61 lib/ 't/lib';
5
6 use CGIscip-perl cpan CGI-Application 4.61 CGI/;
7 use TestCGIscip-perl cpan CGI-Application 4.61 TestCGI/;
8 use TestApp9scip-perl cpan CGI-Application 4.61 TestApp9/;
9
10 # Prevent output to STDOUT
11 $ENVscip-perl cpan CGI-Application 4.61 main/`%ENV`.{CGI_APP_RETURN_ONLY} = 1;
12
13 # Test making a modification to the output body
14 {
15 my $q = CGI->newscip-perl cpan CGI-Application 4.61 CGI/new().({rm=>"postrun_body"});
16 my $app = TestApp9->newscip-perl cpan CGI-Application 4.61 TestApp9/new().(QUERY=>$q);
17 my $output = $app->runscip-perl cpan CGI-Application 4.61 TestApp9/run().();
18 likescip-perl cpan CGI-Application 4.61 main/like().($output, qr/^Content\-Type\:\ text\/html/, "Postrun body has headers");
19 likescip-perl cpan CGI-Application 4.61 main/like().($output, qr/Hello world: postrun_body/, "Hello world: postrun_body");
20 likescip-perl cpan CGI-Application 4.61 main/like().($output, qr/postrun\ was\ here/, "Postrun was here");
21 }
22
23
24 # Test changing HTTP headers
25 {
26 my $q = CGI->newscip-perl cpan CGI-Application 4.61 CGI/new().({rm=>"postrun_header"});
27 my $app = TestApp9->newscip-perl cpan CGI-Application 4.61 TestApp9/new().(QUERY=>$q);
28 my $output = $app->runscip-perl cpan CGI-Application 4.61 TestApp9/run().();
29 likescip-perl cpan CGI-Application 4.61 main/like().($output, qr/^Status: 302/, "Postrun header is redirect");
30 likescip-perl cpan CGI-Application 4.61 main/like().($output, qr/postrun.html/, "Postrun header is redirect to postrun.html");
31 likescip-perl cpan CGI-Application 4.61 main/like().($output, qr/Hello world: postrun_header/, "Hello world: postrun_header");
32 unlikescip-perl cpan CGI-Application 4.61 main/unlike().($output, qr/postrun\ was\ here/, "Postrun was NOT here");
33 }