4 use HTTP::Request::Common;
7 package MyApp::Controller::Root;
8 $INC{'MyApp/Controller/Root.pm'} = __FILE__;
10 use base 'Catalyst::Controller';
12 MyApp::Controller::Root->config(namespace=>'');
14 sub could_throw :Private {
16 if ($c->req->args->[0] eq 'y') {
17 die 'Bad stuff happened';
27 my $ret = $c->forward('/could_throw/y');
28 Test::More::is($c->state, 0, 'Throwing: state is correct');
29 Test::More::is($ret, 0, 'Throwing: return is correct');
30 Test::More::ok($c->has_errors, 'Throwing: has errors');
33 sub dont_throw :Local {
36 my $ret = $c->forward('/could_throw/n');
37 Test::More::is($c->state, 5, 'Not throwing: state is correct');
38 Test::More::is($ret, 5, 'Not throwing: return is correct');
39 Test::More::ok(!$c->has_errors, 'Throwing: no errors');
45 MyApp->config(show_internal_actions=>1);
49 use Catalyst::Test 'MyApp';
54 ctx_request("/dont_throw");
55 ctx_request("/do_throw");
56 ctx_request("/dont_throw");