#!perl
use
lib
"$FindBin::Bin/lib"
;
our
$iters
;
BEGIN {
$iters
=
$ENV
{CAT_BENCH_ITERS} || 2; }
if
(
$ENV
{CAT_BENCHMARK} ) {
Benchmark::timethis(
$iters
, \
&run_tests
);
}
else
{
for
( 1 ..
$iters
) {
run_tests();
}
}
sub
run_tests {
{
my
@expected
=
qw[
TestApp::Controller::Action::End->begin
TestApp::Controller::Action::End->default
TestApp::View::Dump::Request->process
TestApp::Controller::Action::End->end
]
;
my
$expected
=
join
(
", "
,
@expected
);
ok(
$response
->is_success,
'Response Successful 2xx'
);
is(
$response
->content_type,
'text/plain'
,
'Response Content-Type'
);
is(
$response
->header(
'X-Catalyst-Action'
),
'default'
,
'Test Action'
);
is(
$response
->header(
'X-Test-Class'
),
'TestApp::Controller::Action::End'
,
'Test Class'
);
is(
$response
->header(
'X-Catalyst-Executed'
),
$expected
,
'Executed actions'
);
like(
$response
->content,
qr/^bless\( .* 'Catalyst::Request' \)$/
s,
'Content is a serialized Catalyst::Request'
);
}
}