File: 03-httpheaders.t

package info (click to toggle)
libcgi-application-plugin-devpopup-perl 1.07-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 292 kB
  • sloc: perl: 481; sh: 56; makefile: 4
file content (49 lines) | stat: -rw-r--r-- 1,045 bytes parent folder | download | duplicates (5)
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
37
38
39
40
41
42
43
44
45
46
47
48
49
use Test::More tests => 4;
use Data::Dumper;

BEGIN { $ENV{CAP_DEVPOPUP_EXEC} = 1; }

{
	package My::App;
	use base qw/CGI::Application/;
	use CGI::Application::Plugin::DevPopup;
    use CGI::Application::Plugin::DevPopup::HTTPHeaders;

	sub setup
	{
		my $self = shift;
		$self->add_callback('devpopup_report', 'my_report');
		$self->start_mode('runmode');
		$self->run_modes([ qw/runmode/ ]);
	}

	sub runmode
	{
		my $self = shift;
		return '<html><body>Hi there!</body></html>';
	}

	sub my_report
	{
		my $self = shift;
		my $outputref = shift;
		$self->devpopup->add_report(
			title => 'Test 1',
			report => 'Test 1 report body',
		);
	}
}

$ENV{CGI_APP_RETURN_ONLY} = 1;
$ENV{HTTP_HOST} = undef; # RT #42315

my $app    = My::App->new;
my $output = $app->run;

like($output, qr/Test 1 report body/, 'Report generated');

like($output, qr/resizable/, 'Window is resizable');
like($output, qr/scrollbars/, 'Window has scrollbars'); # See RT #16012
like($output, qr{\QHTTP_HOST </td><td>  </td>}, 'see http headers, no warning');

__END__