From: Tomas Doran Date: Mon, 7 Sep 2009 20:35:57 +0000 (+0000) Subject: Merge 'trunk' into 'deprecate_appclass_actions' X-Git-Tag: 5.80013~12^2~1 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=commitdiff_plain;h=9563d3701ebb2e6a4ac4760ab84af6eb3ab7adc2;hp=4f4ab5b4e0f1cf9a41e019f52067e968764ee7f4 Merge 'trunk' into 'deprecate_appclass_actions' r11024@t0mlaptop (orig r11023): caelum | 2009-08-01 20:04:08 +0100 allow uri_for($controller_instance) r11035@t0mlaptop (orig r11034): t0m | 2009-08-05 20:39:01 +0100 Require perl 5.8.6 r11038@t0mlaptop (orig r11037): hobbs | 2009-08-06 10:57:02 +0100 Add a method to the stats object to get the request start time. r11048@t0mlaptop (orig r11047): t0m | 2009-08-07 01:15:04 +0100 Fix the perl version required there also r11049@t0mlaptop (orig r11048): t0m | 2009-08-07 01:24:17 +0100 Blow up if we're in author mode and don't have the right M::I extensions r11050@t0mlaptop (orig r11049): t0m | 2009-08-07 01:57:21 +0100 Bump MX::MA dep for anon class tests r11058@t0mlaptop (orig r11057): gbjk | 2009-08-07 17:45:03 +0100 DispatchType::Chained fix for default args attribute to handle Args(0) vs Args() at depth. r11059@t0mlaptop (orig r11058): gbjk | 2009-08-07 18:17:15 +0100 DispatchType::Chained fix failing test of Args(0) vs Args(0) on surface r11062@t0mlaptop (orig r11061): gbjk | 2009-08-07 22:17:22 +0100 Engine::HTTP - Fix paths for HTTP requests with scheme and domain in URI. r11064@t0mlaptop (orig r11063): groditi | 2009-08-08 22:54:04 +0100 make debug output prettier with large widths r11065@t0mlaptop (orig r11064): groditi | 2009-08-08 22:54:46 +0100 oops debug output got leaked in r11069@t0mlaptop (orig r11068): t0m | 2009-08-09 13:36:20 +0100 Fix RT#48555 r11070@t0mlaptop (orig r11069): t0m | 2009-08-09 13:36:55 +0100 Updates changelog r11071@t0mlaptop (orig r11070): t0m | 2009-08-09 15:22:21 +0100 Rewrite fixes for RT#48555 r11123@t0mlaptop (orig r11122): t0m | 2009-08-11 22:49:37 +0100 Unfuck Catalyst::View::JSON r11125@t0mlaptop (orig r11124): t0m | 2009-08-11 23:32:47 +0100 Apply patch from RT#48623 to fix headers in Engine::HTTP r11127@t0mlaptop (orig r11126): rjbs | 2009-08-12 00:33:18 +0100 svn merge -r 11123:11125 branches/locate_components/ trunk/ r11128@t0mlaptop (orig r11127): rjbs | 2009-08-12 00:34:12 +0100 add changelog entry for merged locate_components branch r11130@t0mlaptop (orig r11129): t0m | 2009-08-12 01:15:51 +0100 Tiny change to make the error make more sense r11132@t0mlaptop (orig r11131): t0m | 2009-08-12 02:09:09 +0100 Split test out into a more proper app, so that the test no longer relies on the metaclass initialization hacking occurring in ->setup_component, as I want to move it r11133@t0mlaptop (orig r11132): t0m | 2009-08-12 02:11:07 +0100 Blow up rather than failing to call ->can if everything is totally screwed r11134@t0mlaptop (orig r11133): rafl | 2009-08-12 03:54:52 +0100 Fix POD refering to CGI::Cookie. We're using CGI::Simple::Cookie. Courtesy of Forrest Cahoon. r11135@t0mlaptop (orig r11134): t0m | 2009-08-12 12:03:06 +0100 Make the code much clearer about what is going on, and remove the horrible map and grep which I hated. r11140@t0mlaptop (orig r11139): rafl | 2009-08-16 10:19:58 +0100 Do at least one (possibly empty) write when reading the response body from a filehandle. r11145@t0mlaptop (orig r11144): jshirley | 2009-08-17 22:33:17 +0100 Adding and documented X-Forwarded-Port r11146@t0mlaptop (orig r11145): t0m | 2009-08-17 23:08:19 +0100 Capitalisation fixes in Changelog r11147@t0mlaptop (orig r11146): t0m | 2009-08-17 23:11:34 +0100 Add _component_name stuff to Changes r11148@t0mlaptop (orig r11147): jshirley | 2009-08-17 23:13:05 +0100 Conflict resolution r11149@t0mlaptop (orig r11148): hobbs | 2009-08-17 23:24:46 +0100 Changelog for r11037 r11150@t0mlaptop (orig r11149): t0m | 2009-08-18 00:14:38 +0100 Switch to catalyst_component_name r11154@t0mlaptop (orig r11153): ferz | 2009-08-18 07:55:14 +0100 Test case using Exception::Class r11155@t0mlaptop (orig r11154): ferz | 2009-08-18 12:19:40 +0100 drop POD comments. r11166@t0mlaptop (orig r11165): t0m | 2009-08-19 20:03:01 +0100 Move test to make more sense in my idea of the naming scheme - t/dead_ is for tests which check the app pukes, which this shouldn't r11167@t0mlaptop (orig r11166): t0m | 2009-08-19 20:04:59 +0100 Fail commit was fail. Back out the part I didn't want r11168@t0mlaptop (orig r11167): t0m | 2009-08-19 20:10:06 +0100 Remove r11058 - the commit message is lies, it does not fix the TODO test r11169@t0mlaptop (orig r11168): t0m | 2009-08-19 21:21:44 +0100 Back out r11057 which breaks one of the chained tests, whilst not fixing the bug in question r11170@t0mlaptop (orig r11169): t0m | 2009-08-19 21:29:16 +0100 Clean up test app for the exception test, as we don't want to depend on Test::Class thanks r11171@t0mlaptop (orig r11170): rafl | 2009-08-19 21:45:45 +0100 Changelog Engine::finalize_body changes. r11181@t0mlaptop (orig r11180): gbjk | 2009-08-21 14:07:54 +0100 Changelog update for previous Catalyst::Engine::HTTP fix. r11182@t0mlaptop (orig r11181): rafl | 2009-08-21 16:51:26 +0100 Now we don't have the broken restarter engine anymore, we conflict with old Catalyst::Devel versions, that don't have the new restarter yet. r11183@t0mlaptop (orig r11182): rafl | 2009-08-21 17:12:57 +0100 Conflict with the latest mason view, which blows up because of the new component_name constructor arg. r11184@t0mlaptop (orig r11183): rafl | 2009-08-21 17:13:05 +0100 Version 5.80008. r11190@t0mlaptop (orig r11189): t0m | 2009-08-21 20:54:58 +0100 Fix and tests for big issue in 5.80008 r11191@t0mlaptop (orig r11190): rafl | 2009-08-21 21:28:30 +0100 Version 5.80009. r11193@t0mlaptop (orig r11192): rafl | 2009-08-21 21:55:25 +0100 DOH! do more than one read, if necessary. r11194@t0mlaptop (orig r11193): rafl | 2009-08-21 22:22:36 +0100 Do what we want instead of exiting a sub via last. r11195@t0mlaptop (orig r11194): rafl | 2009-08-21 22:22:45 +0100 Add test for sending the body from a filehandle with more data than the default chunksize of 64k. r11196@t0mlaptop (orig r11195): rafl | 2009-08-21 22:31:38 +0100 Changelogging. r11197@t0mlaptop (orig r11196): rafl | 2009-08-21 22:41:05 +0100 Version 5.80010. r11215@t0mlaptop (orig r11214): rafl | 2009-08-22 20:56:53 +0100 Remove leftovers of the restarter engine. The removed code caused test failures, which weren't apparent due to installed copies still being available in everyone's @INC. r11218@t0mlaptop (orig r11217): rafl | 2009-08-23 12:46:42 +0100 Changelogging. r11219@t0mlaptop (orig r11218): rafl | 2009-08-23 12:55:48 +0100 Version 5.80011. r11221@t0mlaptop (orig r11220): rafl | 2009-08-23 19:42:17 +0100 Failing test for component loading r11233@t0mlaptop (orig r11232): t0m | 2009-08-24 13:51:03 +0100 Test fixes for if CATALYST_DEBUG is set to 1. r11239@t0mlaptop (orig r11238): t0m | 2009-08-25 12:25:54 +0100 0003-Remove-diag-message.patch (marcus) r11240@t0mlaptop (orig r11239): t0m | 2009-08-25 12:26:15 +0100 Fix duplicate components r11252@t0mlaptop (orig r11251): frew | 2009-08-26 20:00:01 +0100 Look! I'm famous! (See Catalyst-Devel) r11254@t0mlaptop (orig r11253): dandv | 2009-08-27 01:56:26 +0100 POD addition: $c->req->body returns a string or a File::Temp object r11278@t0mlaptop (orig r11277): t0m | 2009-09-01 02:07:23 +0100 Nuke skipped test which will never pass r11279@t0mlaptop (orig r11278): t0m | 2009-09-01 02:07:47 +0100 Author tests r11280@t0mlaptop (orig r11279): t0m | 2009-09-01 02:09:29 +0100 t/author in MANFEST r11281@t0mlaptop (orig r11280): t0m | 2009-09-01 02:10:46 +0100 Stop remote tests breaking everything, and force authors to run some remote tests. r11282@t0mlaptop (orig r11281): t0m | 2009-09-01 02:11:33 +0100 Stop calling class data methods on instances + commented out warning r11283@t0mlaptop (orig r11282): t0m | 2009-09-01 02:11:45 +0100 Changelog r11300@t0mlaptop (orig r11292): t0m | 2009-09-01 15:11:05 +0100 Bump versions back to 5.8.4 r11301@t0mlaptop (orig r11293): t0m | 2009-09-01 15:32:46 +0100 Changes tweaks r11307@t0mlaptop (orig r11299): t0m | 2009-09-02 03:03:58 +0100 Changelogging r11361@t0mlaptop (orig r11331): t0m | 2009-09-07 15:45:01 +0100 Fix hash key name back to what it used to be for compat, keeping renamed accessor where it was. Tests for this breakage to follow r11363@t0mlaptop (orig r11333): t0m | 2009-09-07 21:19:40 +0100 Test for r11331 + fix to only report each action name once from get_action_methods r11364@t0mlaptop (orig r11334): t0m | 2009-09-07 21:21:52 +0100 I'm an idiot, that totally doesn't work. remove. r11365@t0mlaptop (orig r11335): t0m | 2009-09-07 21:25:53 +0100 AGH. Too tired to be doing this, fucked it up again r11366@t0mlaptop (orig r11336): t0m | 2009-09-07 21:33:31 +0100 Fix duplicate results from get_action_methods. Q. Why didn't I just do that first time round? A: Am idiot. --- diff --git a/lib/Catalyst/Controller.pm b/lib/Catalyst/Controller.pm index dc68a33..1d91b3c 100644 --- a/lib/Catalyst/Controller.pm +++ b/lib/Catalyst/Controller.pm @@ -215,10 +215,13 @@ sub register_action_methods { #this is still not correct for some reason. my $namespace = $self->action_namespace($c); - # Uncomment as soon as you fix the tests :) - #if (!blessed($self) && $self eq $c && scalar(@methods)) { - # $c->log->warn("Action methods found defined in your application class, $self. This is deprecated, please move them into a Root controller."); - #} + # FIXME - fugly + if (!blessed($self) && $self eq $c && scalar(@methods)) { + my @really_bad_methods = grep { ! /^_(DISPATCH|BEGIN|AUTO|ACTION|END)$/ } map { $_->name } @methods; + if (scalar(@really_bad_methods)) { + $c->log->warn("Action methods (" . join(', ', @really_bad_methods) . ") found defined in your application class, $self. This is deprecated, please move them into a Root controller."); + } + } foreach my $method (@methods) { my $name = $method->name; diff --git a/t/aggregate/live_component_controller_action_auto.t b/t/aggregate/live_component_controller_action_auto.t index bf566dc..bb34e13 100644 --- a/t/aggregate/live_component_controller_action_auto.t +++ b/t/aggregate/live_component_controller_action_auto.t @@ -35,7 +35,7 @@ sub run_tests { TestApp::Controller::Action::Auto->begin TestApp::Controller::Action::Auto->auto TestApp::Controller::Action::Auto->one - TestApp->end + TestApp::Controller::Root->end ]; my $expected = join( ", ", @expected ); @@ -52,7 +52,7 @@ sub run_tests { TestApp::Controller::Action::Auto->begin TestApp::Controller::Action::Auto->auto TestApp::Controller::Action::Auto->default - TestApp->end + TestApp::Controller::Root->end ]; my $expected = join( ", ", @expected ); @@ -70,7 +70,7 @@ sub run_tests { TestApp::Controller::Action::Auto->auto TestApp::Controller::Action::Auto::Deep->auto TestApp::Controller::Action::Auto::Deep->one - TestApp->end + TestApp::Controller::Root->end ]; my $expected = join( ", ", @expected ); @@ -88,7 +88,7 @@ sub run_tests { TestApp::Controller::Action::Auto->auto TestApp::Controller::Action::Auto::Deep->auto TestApp::Controller::Action::Auto::Deep->default - TestApp->end + TestApp::Controller::Root->end ]; my $expected = join( ", ", @expected ); diff --git a/t/aggregate/live_component_controller_action_begin.t b/t/aggregate/live_component_controller_action_begin.t index 49b3163..e5b2e0f 100644 --- a/t/aggregate/live_component_controller_action_begin.t +++ b/t/aggregate/live_component_controller_action_begin.t @@ -30,7 +30,7 @@ sub run_tests { TestApp::Controller::Action::Begin->begin TestApp::Controller::Action::Begin->default TestApp::View::Dump::Request->process - TestApp->end + TestApp::Controller::Root->end ]; my $expected = join( ", ", @expected ); diff --git a/t/aggregate/live_component_controller_action_chained.t b/t/aggregate/live_component_controller_action_chained.t index 615289c..3784fe6 100644 --- a/t/aggregate/live_component_controller_action_chained.t +++ b/t/aggregate/live_component_controller_action_chained.t @@ -815,7 +815,7 @@ sub run_tests { my @expected = qw[ TestApp::Controller::Action::Chained::Root->rootsub TestApp::Controller::Action::Chained::Root->endpointsub - TestApp->end + TestApp::Controller::Root->end ]; my $expected = join( ", ", @expected ); diff --git a/t/aggregate/live_component_controller_action_default.t b/t/aggregate/live_component_controller_action_default.t index 935a326..51940d4 100644 --- a/t/aggregate/live_component_controller_action_default.t +++ b/t/aggregate/live_component_controller_action_default.t @@ -29,7 +29,7 @@ sub run_tests { TestApp::Controller::Action::Default->begin TestApp::Controller::Action::Default->default TestApp::View::Dump::Request->process - TestApp->end + TestApp::Controller::Root->end ]; my $expected = join( ", ", @expected ); @@ -76,7 +76,7 @@ sub run_tests { my @expected = qw[ TestApp::Controller::Action->begin TestApp::Controller::Action->default - TestApp->end + TestApp::Controller::Root->end ]; my $expected = join( ", ", @expected ); diff --git a/t/aggregate/live_component_controller_action_detach.t b/t/aggregate/live_component_controller_action_detach.t index 5905596..2f43a53 100644 --- a/t/aggregate/live_component_controller_action_detach.t +++ b/t/aggregate/live_component_controller_action_detach.t @@ -30,7 +30,7 @@ sub run_tests { TestApp::Controller::Action::Detach->one TestApp::Controller::Action::Detach->two TestApp::View::Dump::Request->process - TestApp->end + TestApp::Controller::Root->end ]; my $expected = join( ", ", @expected ); @@ -57,7 +57,7 @@ sub run_tests { TestApp::Controller::Action::Detach->path TestApp::Controller::Action::Detach->two TestApp::View::Dump::Request->process - TestApp->end + TestApp::Controller::Root->end ]; my $expected = join( ", ", @expected ); diff --git a/t/aggregate/live_component_controller_action_forward.t b/t/aggregate/live_component_controller_action_forward.t index 3000398..3d838b8 100644 --- a/t/aggregate/live_component_controller_action_forward.t +++ b/t/aggregate/live_component_controller_action_forward.t @@ -33,7 +33,7 @@ sub run_tests { TestApp::Controller::Action::Forward->four TestApp::Controller::Action::Forward->five TestApp::View::Dump::Request->process - TestApp->end + TestApp::Controller::Root->end ]; my $expected = join( ", ", @expected ); @@ -81,7 +81,7 @@ sub run_tests { TestApp::Controller::Action::Forward->four TestApp::Controller::Action::Forward->five TestApp::View::Dump::Request->process - TestApp->end + TestApp::Controller::Root->end ]; my $expected = join( ", ", @expected ); @@ -156,7 +156,7 @@ sub run_tests { TestApp::Controller::Action::Forward->four TestApp::Controller::Action::Forward->five TestApp::View::Dump::Request->process - TestApp->end + TestApp::Controller::Root->end ]; my $expected = join( ", ", @expected ); @@ -191,7 +191,7 @@ sub run_tests { TestApp::Controller::Action::Forward->four TestApp::Controller::Action::Forward->five TestApp::View::Dump::Request->process - TestApp->end + TestApp::Controller::Root->end ]; my $expected = join( ", ", @expected ); diff --git a/t/aggregate/live_component_controller_action_go.t b/t/aggregate/live_component_controller_action_go.t index 9966a94..41b09b6 100644 --- a/t/aggregate/live_component_controller_action_go.t +++ b/t/aggregate/live_component_controller_action_go.t @@ -43,7 +43,7 @@ sub run_tests { TestApp::Controller::Action::Go->four TestApp::Controller::Action::Go->five TestApp::View::Dump::Request->process - TestApp->end + TestApp::Controller::Root->end ]; @expected = map { /Action/ ? (_begin($_), $_) : ($_) } @expected; @@ -74,7 +74,7 @@ sub run_tests { my @expected = qw[ TestApp::Controller::Action::Go->go_die TestApp::Controller::Action::Go->args - TestApp->end + TestApp::Controller::Root->end ]; @expected = map { /Action/ ? (_begin($_), $_) : ($_) } @expected; @@ -165,7 +165,7 @@ sub run_tests { TestApp::Controller::Action::Go->four TestApp::Controller::Action::Go->five TestApp::View::Dump::Request->process - TestApp->end + TestApp::Controller::Root->end ]; @expected = map { /Action/ ? (_begin($_), $_) : ($_) } @expected; @@ -200,7 +200,7 @@ sub run_tests { TestApp::Controller::Action::Go->four TestApp::Controller::Action::Go->five TestApp::View::Dump::Request->process - TestApp->end + TestApp::Controller::Root->end ]; @expected = map { /Action/ ? (_begin($_), $_) : ($_) } @expected; diff --git a/t/aggregate/live_component_controller_action_index.t b/t/aggregate/live_component_controller_action_index.t index 99e9435..7cd24a9 100644 --- a/t/aggregate/live_component_controller_action_index.t +++ b/t/aggregate/live_component_controller_action_index.t @@ -27,8 +27,8 @@ sub run_tests { # test root index { my @expected = qw[ - TestApp->index - TestApp->end + TestApp::Controller::Root->index + TestApp::Controller::Root->end ]; my $expected = join( ", ", @expected ); @@ -45,7 +45,7 @@ sub run_tests { { my @expected = qw[ TestApp::Controller::Index->index - TestApp->end + TestApp::Controller::Root->end ]; my $expected = join( ", ", @expected ); @@ -66,7 +66,7 @@ sub run_tests { my @expected = qw[ TestApp::Controller::Action::Index->begin TestApp::Controller::Action::Index->index - TestApp->end + TestApp::Controller::Root->end ]; my $expected = join( ", ", @expected ); @@ -87,7 +87,7 @@ sub run_tests { my @expected = qw[ TestApp::Controller::Action::Index->begin TestApp::Controller::Action::Index->default - TestApp->end + TestApp::Controller::Root->end ]; my $expected = join( ", ", @expected ); diff --git a/t/aggregate/live_component_controller_action_visit.t b/t/aggregate/live_component_controller_action_visit.t index 468496b..4bd246d 100644 --- a/t/aggregate/live_component_controller_action_visit.t +++ b/t/aggregate/live_component_controller_action_visit.t @@ -42,11 +42,11 @@ sub run_tests { TestApp::Controller::Action::Visit->four TestApp::Controller::Action::Visit->five TestApp::View::Dump::Request->process - TestApp->end - TestApp->end - TestApp->end - TestApp->end - TestApp->end + TestApp::Controller::Root->end + TestApp::Controller::Root->end + TestApp::Controller::Root->end + TestApp::Controller::Root->end + TestApp::Controller::Root->end ]; @expected = map { /Action/ ? (_begin($_), $_) : ($_) } @expected; @@ -76,8 +76,8 @@ sub run_tests { my @expected = qw[ TestApp::Controller::Action::Visit->visit_die TestApp::Controller::Action::Visit->args - TestApp->end - TestApp->end + TestApp::Controller::Root->end + TestApp::Controller::Root->end ]; @expected = map { /Action/ ? (_begin($_), $_) : ($_) } @expected; @@ -166,12 +166,12 @@ sub run_tests { TestApp::Controller::Action::Visit->four TestApp::Controller::Action::Visit->five TestApp::View::Dump::Request->process - TestApp->end - TestApp->end - TestApp->end - TestApp->end - TestApp->end - TestApp->end + TestApp::Controller::Root->end + TestApp::Controller::Root->end + TestApp::Controller::Root->end + TestApp::Controller::Root->end + TestApp::Controller::Root->end + TestApp::Controller::Root->end ]; @expected = map { /Action/ ? (_begin($_), $_) : ($_) } @expected; @@ -206,12 +206,12 @@ sub run_tests { TestApp::Controller::Action::Visit->four TestApp::Controller::Action::Visit->five TestApp::View::Dump::Request->process - TestApp->end - TestApp->end - TestApp->end - TestApp->end - TestApp->end - TestApp->end + TestApp::Controller::Root->end + TestApp::Controller::Root->end + TestApp::Controller::Root->end + TestApp::Controller::Root->end + TestApp::Controller::Root->end + TestApp::Controller::Root->end ]; @expected = map { /Action/ ? (_begin($_), $_) : ($_) } @expected; @@ -266,7 +266,7 @@ sub run_tests { TestApp::Controller::Action::Chained->foo TestApp::Controller::Action::Chained::Foo->spoon TestApp::Controller::Action::Chained->end - TestApp->end + TestApp::Controller::Root->end ]; my $expected = join( ", ", @expected ); diff --git a/t/aggregate/live_engine_request_body.t b/t/aggregate/live_engine_request_body.t index c6670da..954291c 100644 --- a/t/aggregate/live_engine_request_body.t +++ b/t/aggregate/live_engine_request_body.t @@ -80,13 +80,13 @@ use HTTP::Request::Common; # 5.80 regression, see note in Catalyst::Plugin::Test::Plugin { my $request = GET( - 'http://localhost/have_req_body_in_prepare_action', + 'http://localhost/dump/response', 'Content-Type' => 'text/plain', 'Content' => 'x' x 100_000 ); ok( my $response = request($request), 'Request' ); ok( $response->is_success, 'Response Successful 2xx' ); - like( $response->content, qr/^[1-9]/, 'Has body' ); + ok( $response->header('X-Have-Request-Body'), 'X-Have-Request-Body set' ); } diff --git a/t/aggregate/unit_core_action_for.t b/t/aggregate/unit_core_action_for.t index 3e75eaa..c0af9d3 100644 --- a/t/aggregate/unit_core_action_for.t +++ b/t/aggregate/unit_core_action_for.t @@ -12,7 +12,7 @@ plan tests => 4; use_ok('TestApp'); -is(TestApp->action_for('global_action')->code, TestApp->can('global_action'), +is(TestApp->action_for('global_action')->code, TestApp::Controller::Root->can('global_action'), 'action_for on appclass ok'); is(TestApp->controller('Args')->action_for('args')->code, diff --git a/t/custom_live_component_controller_action_auto_doublebug.t b/t/custom_live_component_controller_action_auto_doublebug.t index f5960ef..b1417a0 100644 --- a/t/custom_live_component_controller_action_auto_doublebug.t +++ b/t/custom_live_component_controller_action_auto_doublebug.t @@ -32,9 +32,9 @@ sub run_tests { { my @expected = qw[ - TestAppDoubleAutoBug->auto - TestAppDoubleAutoBug->default - TestAppDoubleAutoBug->end + TestAppDoubleAutoBug::Controller::Root->auto + TestAppDoubleAutoBug::Controller::Root->default + TestAppDoubleAutoBug::Controller::Root->end ]; my $expected = join( ", ", @expected ); diff --git a/t/deprecated_appclass_action_warnings.t b/t/deprecated_appclass_action_warnings.t new file mode 100644 index 0000000..f25d8d5 --- /dev/null +++ b/t/deprecated_appclass_action_warnings.t @@ -0,0 +1,18 @@ +use strict; +use warnings; + +use FindBin; +use lib "$FindBin::Bin/lib"; + +use Test::More; +use Catalyst::Test 'DeprecatedActionsInAppClassTestApp'; + +plan tests => 3; + +my $warnings; +my $logger = DeprecatedActionsInAppClassTestApp::Log->new; +Catalyst->log($logger); + +ok( my $response = request('http://localhost/foo'), 'Request' ); +ok( $response->is_success, 'Response Successful 2xx' ); +is( $DeprecatedActionsInAppClassTestApp::Log::warnings, 1, 'Get the appclass action warning' ); \ No newline at end of file diff --git a/t/lib/ACLTestApp.pm b/t/lib/ACLTestApp.pm new file mode 100644 index 0000000..ec87027 --- /dev/null +++ b/t/lib/ACLTestApp.pm @@ -0,0 +1,26 @@ +package ACLTestApp; +use Test::More; + +use strict; +use warnings; +use MRO::Compat; +use Scalar::Util (); + +use base qw/Catalyst Catalyst::Controller/; +use Catalyst qw//; + +sub execute { + my $c = shift; + my ( $class, $action ) = @_; + + if ( Scalar::Util::blessed($action) + and $action->name ne "foobar" ) { + eval { $c->detach( 'foobar', [$action, 'foo'] ) }; + } + + $c->next::method( @_ ); +} + +__PACKAGE__->setup; + +1; diff --git a/t/lib/ACLTestApp/Controller/Root.pm b/t/lib/ACLTestApp/Controller/Root.pm new file mode 100644 index 0000000..a1aa83b --- /dev/null +++ b/t/lib/ACLTestApp/Controller/Root.pm @@ -0,0 +1,18 @@ +package ACLTestApp::Controller::Root; +use Test::More; + +use base 'Catalyst::Controller'; + +__PACKAGE__->config->{namespace} = ''; + +sub foobar : Private { + die $Catalyst::DETACH; +} + +sub gorch : Local { + my ( $self, $c, $frozjob ) = @_; + is $frozjob, 'wozzle'; + $c->res->body("gorch"); +} + +1; diff --git a/t/lib/Catalyst/Plugin/Test/Plugin.pm b/t/lib/Catalyst/Plugin/Test/Plugin.pm index b620c5e..16f3f63 100644 --- a/t/lib/Catalyst/Plugin/Test/Plugin.pm +++ b/t/lib/Catalyst/Plugin/Test/Plugin.pm @@ -22,26 +22,14 @@ sub prepare { return $c; } -# Note: This is horrible, but Catalyst::Plugin::Server forces the body to +# Note: Catalyst::Plugin::Server forces the body to # be parsed, by calling the $c->req->body method in prepare_action. # We need to test this, as this was broken by 5.80. See also -# t/aggregate/live_engine_request_body.t. Better ways to test this -# appreciated if you have suggestions :) -{ - my $have_req_body = 0; - sub prepare_action { - my $c = shift; - $have_req_body++ if $c->req->body; - $c->next::method(@_); - } - sub have_req_body_in_prepare_action : Local { - my ($self, $c) = @_; - $c->res->body($have_req_body); - } -} - -sub end : Private { - my ($self,$c) = @_; +# t/aggregate/live_engine_request_body.t. +sub prepare_action { + my $c = shift; + $c->res->header('X-Have-Request-Body', 1) if $c->req->body; + $c->next::method(@_); } 1; diff --git a/t/lib/DeprecatedActionsInAppClassTestApp.pm b/t/lib/DeprecatedActionsInAppClassTestApp.pm new file mode 100644 index 0000000..9c870b0 --- /dev/null +++ b/t/lib/DeprecatedActionsInAppClassTestApp.pm @@ -0,0 +1,30 @@ +package DeprecatedActionsInAppClassTestApp; + +use strict; +use warnings; +use Catalyst; + +our $VERSION = '0.01'; + +__PACKAGE__->config( name => 'DeprecatedActionsInAppClassTestApp', root => '/some/dir' ); +__PACKAGE__->log(DeprecatedActionsInAppClassTestApp::Log->new); +__PACKAGE__->setup; + +sub foo : Local { + my ($self, $c) = @_; + $c->res->body('OK'); +} + +package DeprecatedActionsInAppClassTestApp::Log; +use strict; +use warnings; +use base qw/Catalyst::Log/; + +our $warnings; + +sub warn { + my ($self, $warning) = @_; + $warnings++ if $warning =~ /action methods .+ found defined/i; +} + +1; diff --git a/t/lib/PluginTestApp.pm b/t/lib/PluginTestApp.pm index c476736..1031586 100644 --- a/t/lib/PluginTestApp.pm +++ b/t/lib/PluginTestApp.pm @@ -6,48 +6,6 @@ use Catalyst qw( +TestApp::Plugin::FullyQualified ); -sub compile_time_plugins : Local { - my ( $self, $c ) = @_; - - isa_ok $c, 'Catalyst::Plugin::Test::Plugin'; - isa_ok $c, 'TestApp::Plugin::FullyQualified'; - - can_ok $c, 'registered_plugins'; - $c->_test_plugins; - - $c->res->body("ok"); -} - -sub run_time_plugins : Local { - my ( $self, $c ) = @_; - - $c->_test_plugins; - my $faux_plugin = 'Faux::Plugin'; - -# Trick perl into thinking the plugin is already loaded - $INC{'Faux/Plugin.pm'} = 1; - - __PACKAGE__->plugin( faux => $faux_plugin ); - - isa_ok $c, 'Catalyst::Plugin::Test::Plugin'; - isa_ok $c, 'TestApp::Plugin::FullyQualified'; - ok !$c->isa($faux_plugin), - '... and it should not inherit from the instant plugin'; - can_ok $c, 'faux'; - is $c->faux->count, 1, '... and it should behave correctly'; - is_deeply [ $c->registered_plugins ], - [ - qw/Catalyst::Plugin::Test::Plugin - Faux::Plugin - TestApp::Plugin::FullyQualified/ - ], - 'registered_plugins() should report all plugins'; - ok $c->registered_plugins('Faux::Plugin'), - '... and even the specific instant plugin'; - - $c->res->body("ok"); -} - sub _test_plugins { my $c = shift; is_deeply [ $c->registered_plugins ], diff --git a/t/lib/PluginTestApp/Controller/Root.pm b/t/lib/PluginTestApp/Controller/Root.pm new file mode 100644 index 0000000..5358074 --- /dev/null +++ b/t/lib/PluginTestApp/Controller/Root.pm @@ -0,0 +1,55 @@ +package PluginTestApp::Controller::Root; +use Test::More; + +use base 'Catalyst::Controller'; + +#use Catalyst qw( +# Test::Plugin +# +TestApp::Plugin::FullyQualified +# ); + +__PACKAGE__->config->{namespace} = ''; + +sub compile_time_plugins : Local { + my ( $self, $c ) = @_; + + isa_ok $c, 'Catalyst::Plugin::Test::Plugin'; + isa_ok $c, 'TestApp::Plugin::FullyQualified'; + + can_ok $c, 'registered_plugins'; + $c->_test_plugins; + + $c->res->body("ok"); +} + +sub run_time_plugins : Local { + my ( $self, $c ) = @_; + + $c->_test_plugins; + my $faux_plugin = 'Faux::Plugin'; + +# Trick perl into thinking the plugin is already loaded + $INC{'Faux/Plugin.pm'} = 1; + + ref($c)->plugin( faux => $faux_plugin ); + + isa_ok $c, 'Catalyst::Plugin::Test::Plugin'; + isa_ok $c, 'TestApp::Plugin::FullyQualified'; + ok !$c->isa($faux_plugin), + '... and it should not inherit from the instant plugin'; + can_ok $c, 'faux'; + is $c->faux->count, 1, '... and it should behave correctly'; + is_deeply [ $c->registered_plugins ], + [ + qw/Catalyst::Plugin::Test::Plugin + Faux::Plugin + TestApp::Plugin::FullyQualified/ + ], + 'registered_plugins() should report all plugins'; + ok $c->registered_plugins('Faux::Plugin'), + '... and even the specific instant plugin'; + + $c->res->body("ok"); +} + +1; diff --git a/t/lib/TestApp.pm b/t/lib/TestApp.pm index 321f78e..a2fc0b2 100644 --- a/t/lib/TestApp.pm +++ b/t/lib/TestApp.pm @@ -41,16 +41,6 @@ sub count_leaks { TestApp->setup; -sub index : Private { - my ( $self, $c ) = @_; - $c->res->body('root index'); -} - -sub global_action : Private { - my ( $self, $c ) = @_; - $c->forward('TestApp::View::Dump::Request'); -} - sub execute { my $c = shift; my $class = ref( $c->component( $_[0] ) ) || $_[0]; @@ -92,25 +82,6 @@ sub finalize_error { $c->res->body( 'FATAL ERROR: ' . join( ', ', @{ $c->error } ) ); } -sub class_forward_test_method :Private { - my ( $self, $c ) = @_; - $c->response->headers->header( 'X-Class-Forward-Test-Method' => 1 ); -} - -sub loop_test : Local { - my ( $self, $c ) = @_; - - for( 1..1001 ) { - $c->forward( 'class_forward_test_method' ); - } -} - -sub recursion_test : Local { - my ( $self, $c ) = @_; - no warnings 'recursion'; - $c->forward( 'recursion_test' ); -} - { no warnings 'redefine'; sub Catalyst::Log::error { } diff --git a/t/lib/TestApp/Controller/Root.pm b/t/lib/TestApp/Controller/Root.pm index 53d79e2..5aa03dc 100644 --- a/t/lib/TestApp/Controller/Root.pm +++ b/t/lib/TestApp/Controller/Root.pm @@ -20,4 +20,36 @@ sub localregex : LocalRegex('^localregex$') { $c->forward('TestApp::View::Dump::Request'); } +sub index : Private { + my ( $self, $c ) = @_; + $c->res->body('root index'); +} + +sub global_action : Private { + my ( $self, $c ) = @_; + $c->forward('TestApp::View::Dump::Request'); +} + +sub class_forward_test_method :Private { + my ( $self, $c ) = @_; + $c->response->headers->header( 'X-Class-Forward-Test-Method' => 1 ); +} + +sub loop_test : Local { + my ( $self, $c ) = @_; + + for( 1..1001 ) { + $c->forward( 'class_forward_test_method' ); + } +} + +sub recursion_test : Local { + my ( $self, $c ) = @_; + $c->forward( 'recursion_test' ); +} + +sub end : Private { + my ($self,$c) = @_; +} + 1; diff --git a/t/lib/TestAppDoubleAutoBug.pm b/t/lib/TestAppDoubleAutoBug.pm index 00855cd..82a5e07 100644 --- a/t/lib/TestAppDoubleAutoBug.pm +++ b/t/lib/TestAppDoubleAutoBug.pm @@ -44,16 +44,3 @@ sub execute { return $c->SUPER::execute(@_); } - - - -sub auto : Private { - my ( $self, $c ) = @_; - ++$c->stash->{auto_count}; - return 1; -} - -sub default : Private { - my ( $self, $c ) = @_; - $c->res->body( sprintf 'default, auto=%d', $c->stash->{auto_count} ); -} diff --git a/t/lib/TestAppDoubleAutoBug/Controller/Root.pm b/t/lib/TestAppDoubleAutoBug/Controller/Root.pm new file mode 100644 index 0000000..2d0b1a6 --- /dev/null +++ b/t/lib/TestAppDoubleAutoBug/Controller/Root.pm @@ -0,0 +1,22 @@ +package TestAppDoubleAutoBug::Controller::Root; + +use base 'Catalyst::Controller'; + +__PACKAGE__->config->{namespace} = ''; + +sub auto : Private { + my ( $self, $c ) = @_; + ++$c->stash->{auto_count}; + return 1; +} + +sub default : Private { + my ( $self, $c ) = @_; + $c->res->body( sprintf 'default, auto=%d', $c->stash->{auto_count} ); +} + +sub end : Private { + my ($self,$c) = @_; +} + +1; diff --git a/t/lib/TestAppPathBug.pm b/t/lib/TestAppPathBug.pm index 3d3b11b..74a2f27 100644 --- a/t/lib/TestAppPathBug.pm +++ b/t/lib/TestAppPathBug.pm @@ -2,13 +2,15 @@ use strict; use warnings; package TestAppPathBug; - +use strict; +use warnings; use Catalyst; our $VERSION = '0.01'; __PACKAGE__->config( name => 'TestAppPathBug', root => '/some/dir' ); +__PACKAGE__->log(TestAppPathBug::Log->new); __PACKAGE__->setup; sub foo : Path { @@ -16,4 +18,11 @@ sub foo : Path { $c->res->body( 'This is the foo method.' ); } +package TestAppPathBug::Log; +use strict; +use warnings; +use base qw/Catalyst::Log/; + +sub warn {} + 1; diff --git a/t/lib/TestAppPluginWithConstructor.pm b/t/lib/TestAppPluginWithConstructor.pm index 36d8e16..5b4b8c1 100644 --- a/t/lib/TestAppPluginWithConstructor.pm +++ b/t/lib/TestAppPluginWithConstructor.pm @@ -6,11 +6,6 @@ use Catalyst qw/+TestPluginWithConstructor/; use Moose; BEGIN { extends qw/Catalyst Catalyst::Controller/ } # Ewww, FIXME. -sub foo : Local { - my ($self, $c) = @_; - $c->res->body('foo'); -} - __PACKAGE__->setup; our $MODIFIER_FIRED = 0; diff --git a/t/lib/TestAppPluginWithConstructor/Controller/Root.pm b/t/lib/TestAppPluginWithConstructor/Controller/Root.pm new file mode 100644 index 0000000..d032fd2 --- /dev/null +++ b/t/lib/TestAppPluginWithConstructor/Controller/Root.pm @@ -0,0 +1,12 @@ +package TestAppPluginWithConstructor::Controller::Root; + +use base 'Catalyst::Controller'; + +__PACKAGE__->config->{namespace} = ''; + +sub foo : Local { + my ($self, $c) = @_; + $c->res->body('foo'); +} + +1; diff --git a/t/lib/TestAppStats.pm b/t/lib/TestAppStats.pm index bfc1340..6e3b320 100644 --- a/t/lib/TestAppStats.pm +++ b/t/lib/TestAppStats.pm @@ -16,16 +16,8 @@ __PACKAGE__->log(TestAppStats::Log->new); __PACKAGE__->setup; -# Return log messages from previous request -sub default : Private { - my ( $self, $c ) = @_; - $c->stats->profile("test"); - $c->res->body(join("\n", @log_messages)); - @log_messages = (); -} - package TestAppStats::Log; use base qw/Catalyst::Log/; -sub info { push(@log_messages, @_); } -sub debug { push(@log_messages, @_); } +sub info { push(@TestAppStats::log_messages, @_); } +sub debug { push(@TestAppStats::log_messages, @_); } diff --git a/t/lib/TestAppStats/Controller/Root.pm b/t/lib/TestAppStats/Controller/Root.pm new file mode 100644 index 0000000..a46856a --- /dev/null +++ b/t/lib/TestAppStats/Controller/Root.pm @@ -0,0 +1,16 @@ +package TestAppStats::Controller::Root; +use strict; +use warnings; +use base 'Catalyst::Controller'; + +__PACKAGE__->config->{namespace} = ''; + +# Return log messages from previous request +sub default : Private { + my ( $self, $c ) = @_; + $c->stats->profile("test"); + $c->res->body(join("\n", @TestAppStats::log_messages)); + @TestAppStats::log_messages = (); +} + +1; diff --git a/t/unit_dispatcher_requestargs_restore.t b/t/unit_dispatcher_requestargs_restore.t index 731c4da..1ffff9c 100644 --- a/t/unit_dispatcher_requestargs_restore.t +++ b/t/unit_dispatcher_requestargs_restore.t @@ -10,42 +10,6 @@ # executing another action from the dispatcher (i.e. wrapping actions) # is present, so that the Authorization::ACL plugin can be re-written # to not be full of such crazy shit. -{ - package ACLTestApp; - use Test::More; - - use strict; - use warnings; - use MRO::Compat; - use Scalar::Util (); - - use base qw/Catalyst Catalyst::Controller/; - use Catalyst qw//; - - sub execute { - my $c = shift; - my ( $class, $action ) = @_; - - if ( Scalar::Util::blessed($action) - and $action->name ne "foobar" ) { - eval { $c->detach( 'foobar', [$action, 'foo'] ) }; - } - - $c->next::method( @_ ); - } - - sub foobar : Private { - die $Catalyst::DETACH; - } - - sub gorch : Local { - my ( $self, $c, $frozjob ) = @_; - is $frozjob, 'wozzle'; - $c->res->body("gorch"); - } - - __PACKAGE__->setup; -} use strict; use warnings;