[Catalyst-commits] r8466 - in Catalyst-Engine-HTTPEngine/trunk/t: .
aggregate lib lib/Catalyst lib/Catalyst/Action
lib/Catalyst/Plugin lib/Catalyst/Plugin/Test lib/TestApp
lib/TestApp/Action lib/TestApp/Controller
lib/TestApp/Controller/Action lib/TestApp/Controller/Action/Auto
lib/TestApp/Controller/Action/Chained
lib/TestApp/Controller/Action/Chained/Auto
lib/TestApp/Controller/Action/Chained/ParentChain
lib/TestApp/Controller/Engine lib/TestApp/Controller/Engine/Request
lib/TestApp/Controller/Engine/Response
lib/TestApp/Controller/Priorities lib/TestApp/Model
lib/TestApp/Model/Foo lib/TestApp/Plugin lib/TestApp/View
lib/TestApp/View/Dump lib/TestAppChainedAbsolutePathPart
lib/TestAppChainedAbsolutePathPart/Controller
lib/TestAppChainedRecursive
lib/TestAppChainedRecursive/Controller lib/TestAppOnDemand
lib/TestAppOnDemand/Controller
andyg at dev.catalyst.perl.org
andyg at dev.catalyst.perl.org
Sun Sep 28 23:46:28 BST 2008
Author: andyg
Date: 2008-09-28 23:46:28 +0100 (Sun, 28 Sep 2008)
New Revision: 8466
Added:
Catalyst-Engine-HTTPEngine/trunk/t/01use.t
Catalyst-Engine-HTTPEngine/trunk/t/02pod.t
Catalyst-Engine-HTTPEngine/trunk/t/03podcoverage.t
Catalyst-Engine-HTTPEngine/trunk/t/04critic.t
Catalyst-Engine-HTTPEngine/trunk/t/aggregate/
Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_component_controller_action_action.t
Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_component_controller_action_auto.t
Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_component_controller_action_begin.t
Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_component_controller_action_chained.t
Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_component_controller_action_default.t
Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_component_controller_action_detach.t
Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_component_controller_action_end.t
Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_component_controller_action_forward.t
Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_component_controller_action_global.t
Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_component_controller_action_go.t
Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_component_controller_action_index.t
Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_component_controller_action_inheritance.t
Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_component_controller_action_local.t
Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_component_controller_action_multipath.t
Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_component_controller_action_path.t
Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_component_controller_action_private.t
Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_component_controller_action_regexp.t
Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_component_controller_action_streaming.t
Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_component_controller_action_visit.t
Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_component_controller_args.t
Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_engine_request_auth.t
Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_engine_request_body.t
Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_engine_request_body_demand.t
Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_engine_request_cookies.t
Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_engine_request_headers.t
Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_engine_request_parameters.t
Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_engine_request_uploads.t
Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_engine_request_uri.t
Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_engine_response_cookies.t
Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_engine_response_errors.t
Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_engine_response_headers.t
Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_engine_response_large.t
Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_engine_response_redirect.t
Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_engine_response_status.t
Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_engine_setup_basics.t
Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_engine_setup_plugins.t
Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_loop.t
Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_plugin_loaded.t
Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_priorities.t
Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_recursion.t
Catalyst-Engine-HTTPEngine/trunk/t/lib/
Catalyst-Engine-HTTPEngine/trunk/t/lib/Catalyst/
Catalyst-Engine-HTTPEngine/trunk/t/lib/Catalyst/Action/
Catalyst-Engine-HTTPEngine/trunk/t/lib/Catalyst/Action/TestAfter.pm
Catalyst-Engine-HTTPEngine/trunk/t/lib/Catalyst/Action/TestBefore.pm
Catalyst-Engine-HTTPEngine/trunk/t/lib/Catalyst/Plugin/
Catalyst-Engine-HTTPEngine/trunk/t/lib/Catalyst/Plugin/Test/
Catalyst-Engine-HTTPEngine/trunk/t/lib/Catalyst/Plugin/Test/Errors.pm
Catalyst-Engine-HTTPEngine/trunk/t/lib/Catalyst/Plugin/Test/Headers.pm
Catalyst-Engine-HTTPEngine/trunk/t/lib/Catalyst/Plugin/Test/Plugin.pm
Catalyst-Engine-HTTPEngine/trunk/t/lib/PluginTestApp.pm
Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp.pm
Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/
Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Action/
Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Action/TestBefore.pm
Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Action/TestMyAction.pm
Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/
Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action.pm
Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/
Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Action.pm
Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Auto.pm
Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Auto/
Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Auto/Abort.pm
Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Auto/Deep.pm
Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Auto/Default.pm
Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Begin.pm
Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Chained.pm
Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Chained/
Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Chained/ArgsOrder.pm
Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Chained/Auto.pm
Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Chained/Auto/
Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Chained/Auto/Bar.pm
Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Chained/Auto/Detach.pm
Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Chained/Auto/Foo.pm
Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Chained/Auto/Forward.pm
Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Chained/Bar.pm
Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Chained/Foo.pm
Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Chained/ParentChain.pm
Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Chained/ParentChain/
Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Chained/ParentChain/Relative.pm
Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Chained/PassedArgs.pm
Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Chained/PathPrefix.pm
Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Chained/Root.pm
Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Default.pm
Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Detach.pm
Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/End.pm
Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Forward.pm
Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/ForwardTo.pm
Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Global.pm
Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Go.pm
Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Index.pm
Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Inheritance.pm
Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Local.pm
Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Path.pm
Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Private.pm
Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Regexp.pm
Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Streaming.pm
Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/TestMultipath.pm
Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/TestRelative.pm
Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Visit.pm
Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Args.pm
Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Dump.pm
Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Engine/
Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Engine/Request/
Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Engine/Request/URI.pm
Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Engine/Request/Uploads.pm
Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Engine/Response/
Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Engine/Response/Cookies.pm
Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Engine/Response/Errors.pm
Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Engine/Response/Headers.pm
Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Engine/Response/Large.pm
Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Engine/Response/Print.pm
Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Engine/Response/Redirect.pm
Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Engine/Response/Status.pm
Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Fork.pm
Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Index.pm
Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Priorities.pm
Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Priorities/
Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Priorities/MultiMethod.pm
Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Priorities/loc_vs_index.pm
Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Priorities/locre_vs_index.pm
Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Priorities/path_vs_index.pm
Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Priorities/re_vs_index.pm
Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Root.pm
Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Model/
Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Model/Foo.pm
Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Model/Foo/
Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Model/Foo/Bar.pm
Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Plugin/
Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Plugin/FullyQualified.pm
Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/View/
Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/View/Dump.pm
Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/View/Dump/
Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/View/Dump/Parameters.pm
Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/View/Dump/Request.pm
Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/View/Dump/Response.pm
Catalyst-Engine-HTTPEngine/trunk/t/lib/TestAppChainedAbsolutePathPart.pm
Catalyst-Engine-HTTPEngine/trunk/t/lib/TestAppChainedAbsolutePathPart/
Catalyst-Engine-HTTPEngine/trunk/t/lib/TestAppChainedAbsolutePathPart/Controller/
Catalyst-Engine-HTTPEngine/trunk/t/lib/TestAppChainedAbsolutePathPart/Controller/Foo.pm
Catalyst-Engine-HTTPEngine/trunk/t/lib/TestAppChainedRecursive.pm
Catalyst-Engine-HTTPEngine/trunk/t/lib/TestAppChainedRecursive/
Catalyst-Engine-HTTPEngine/trunk/t/lib/TestAppChainedRecursive/Controller/
Catalyst-Engine-HTTPEngine/trunk/t/lib/TestAppChainedRecursive/Controller/Foo.pm
Catalyst-Engine-HTTPEngine/trunk/t/lib/TestAppDoubleAutoBug.pm
Catalyst-Engine-HTTPEngine/trunk/t/lib/TestAppOnDemand.pm
Catalyst-Engine-HTTPEngine/trunk/t/lib/TestAppOnDemand/
Catalyst-Engine-HTTPEngine/trunk/t/lib/TestAppOnDemand/Controller/
Catalyst-Engine-HTTPEngine/trunk/t/lib/TestAppOnDemand/Controller/Body.pm
Catalyst-Engine-HTTPEngine/trunk/t/lib/TestAppPathBug.pm
Catalyst-Engine-HTTPEngine/trunk/t/lib/TestAppStats.pm
Catalyst-Engine-HTTPEngine/trunk/t/optional_httpengine-server.t
Catalyst-Engine-HTTPEngine/trunk/t/testapp_httpengine.pl
Log:
Test suite for HTTPEngine
Added: Catalyst-Engine-HTTPEngine/trunk/t/01use.t
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/01use.t (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/01use.t 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,3 @@
+use Test::More tests => 1;
+
+use_ok('Catalyst::Engine::HTTPEngine');
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/01use.t
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/02pod.t
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/02pod.t (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/02pod.t 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,7 @@
+use Test::More;
+
+eval "use Test::Pod 1.14";
+plan skip_all => 'Test::Pod 1.14 required' if $@;
+plan skip_all => 'set TEST_POD to enable this test' unless $ENV{TEST_POD} || -e 'inc/.author';
+
+all_pod_files_ok();
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/02pod.t
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/03podcoverage.t
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/03podcoverage.t (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/03podcoverage.t 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,11 @@
+use Test::More;
+
+eval "use Test::Pod::Coverage 1.04";
+plan skip_all => 'Test::Pod::Coverage 1.04 required' if $@;
+plan skip_all => 'set TEST_POD to enable this test' unless $ENV{TEST_POD} || -e 'inc/.author';
+
+all_pod_coverage_ok(
+ {
+ also_private => ['BUILD']
+ }
+);
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/03podcoverage.t
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/04critic.t
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/04critic.t (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/04critic.t 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,21 @@
+use strict;
+use warnings;
+
+use File::Spec;
+use FindBin ();
+use Test::More;
+
+if ( !-e "$FindBin::Bin/../MANIFEST.SKIP" ) {
+ plan skip_all => 'Critic test only for developers.';
+}
+else {
+ eval { require Test::NoTabs };
+ if ( $@ ) {
+ plan tests => 1;
+ fail( 'You must install Test::NoTabs to run 04critic.t' );
+ exit;
+ }
+}
+
+Test::NoTabs->import;
+all_perl_files_ok(qw/lib/);
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/04critic.t
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_component_controller_action_action.t
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_component_controller_action_action.t (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_component_controller_action_action.t 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,110 @@
+#!perl
+
+use strict;
+use warnings;
+
+use FindBin;
+use lib "$FindBin::Bin/../lib";
+
+our $iters;
+
+BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; }
+
+use Test::More tests => 28 * $iters;
+use Catalyst::Test 'TestApp';
+
+if ( $ENV{CAT_BENCHMARK} ) {
+ require Benchmark;
+ Benchmark::timethis( $iters, \&run_tests );
+}
+else {
+ for ( 1 .. $iters ) {
+ run_tests();
+ }
+}
+
+sub run_tests {
+ {
+ ok( my $response = request('http://localhost/action_action_one'),
+ 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ is( $response->header('X-Catalyst-Action'),
+ 'action_action_one', 'Test Action' );
+ is(
+ $response->header('X-Test-Class'),
+ 'TestApp::Controller::Action::Action',
+ 'Test Class'
+ );
+ is( $response->header('X-Action'), 'works' );
+ like(
+ $response->content,
+ qr/^bless\( .* 'Catalyst::Request' \)$/s,
+ 'Content is a serialized Catalyst::Request'
+ );
+ }
+
+ {
+ ok( my $response = request('http://localhost/action_action_two'),
+ 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ is( $response->header('X-Catalyst-Action'),
+ 'action_action_two', 'Test Action' );
+ is(
+ $response->header('X-Test-Class'),
+ 'TestApp::Controller::Action::Action',
+ 'Test Class'
+ );
+ is( $response->header('X-Action-After'), 'awesome' );
+ like(
+ $response->content,
+ qr/^bless\( .* 'Catalyst::Request' \)$/s,
+ 'Content is a serialized Catalyst::Request'
+ );
+ }
+
+ {
+ ok(
+ my $response =
+ request('http://localhost/action_action_three/one/two'),
+ 'Request'
+ );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ is( $response->header('X-Catalyst-Action'),
+ 'action_action_three', 'Test Action' );
+ is(
+ $response->header('X-Test-Class'),
+ 'TestApp::Controller::Action::Action',
+ 'Test Class'
+ );
+ is( $response->header('X-TestAppActionTestBefore'), 'one' );
+ like(
+ $response->content,
+ qr/^bless\( .* 'Catalyst::Request' \)$/s,
+ 'Content is a serialized Catalyst::Request'
+ );
+ }
+
+ {
+ ok( my $response = request('http://localhost/action_action_four'),
+ 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ is( $response->header('X-Catalyst-Action'),
+ 'action_action_four', 'Test Action' );
+ is(
+ $response->header('X-Test-Class'),
+ 'TestApp::Controller::Action::Action',
+ 'Test Class'
+ );
+ is( $response->header('X-TestAppActionTestMyAction'), 'MyAction works' );
+ like(
+ $response->content,
+ qr/^bless\( .* 'Catalyst::Request' \)$/s,
+ 'Content is a serialized Catalyst::Request'
+ );
+ }
+
+}
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_component_controller_action_action.t
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_component_controller_action_auto.t
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_component_controller_action_auto.t (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_component_controller_action_auto.t 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,136 @@
+#!perl
+
+use strict;
+use warnings;
+
+use FindBin;
+use lib "$FindBin::Bin/../lib";
+
+our $iters;
+
+BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; }
+
+use Test::More tests => 18*$iters;
+use Catalyst::Test 'TestApp';
+
+if ( $ENV{CAT_BENCHMARK} ) {
+ require Benchmark;
+ Benchmark::timethis( $iters, \&run_tests );
+
+ # new dispatcher:
+ # 11 wallclock secs (10.14 usr + 0.20 sys = 10.34 CPU) @ 15.18/s (n=157)
+ # old dispatcher (r1486):
+ # 11 wallclock secs (10.34 usr + 0.20 sys = 10.54 CPU) @ 13.76/s (n=145)
+}
+else {
+ for ( 1 .. $iters ) {
+ run_tests();
+ }
+}
+
+sub run_tests {
+ # test auto + local method
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Auto->begin
+ TestApp::Controller::Action::Auto->auto
+ TestApp::Controller::Action::Auto->one
+ TestApp->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/action/auto/one'), 'auto + local' );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->content, 'one', 'Content OK' );
+ }
+
+ # test auto + default
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Auto->begin
+ TestApp::Controller::Action::Auto->auto
+ TestApp::Controller::Action::Auto->default
+ TestApp->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/action/auto/anything'), 'auto + default' );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->content, 'default', 'Content OK' );
+ }
+
+ # test auto + auto + local
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Auto::Deep->begin
+ TestApp::Controller::Action::Auto->auto
+ TestApp::Controller::Action::Auto::Deep->auto
+ TestApp::Controller::Action::Auto::Deep->one
+ TestApp->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/action/auto/deep/one'), 'auto + auto + local' );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->content, 'deep one', 'Content OK' );
+ }
+
+ # test auto + auto + default
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Auto::Deep->begin
+ TestApp::Controller::Action::Auto->auto
+ TestApp::Controller::Action::Auto::Deep->auto
+ TestApp::Controller::Action::Auto::Deep->default
+ TestApp->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/action/auto/deep/anything'), 'auto + auto + default' );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->content, 'deep default', 'Content OK' );
+ }
+
+ # test auto + failing auto + local + end
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Auto::Abort->begin
+ TestApp::Controller::Action::Auto->auto
+ TestApp::Controller::Action::Auto::Abort->auto
+ TestApp::Controller::Action::Auto::Abort->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/action/auto/abort/one'), 'auto + failing auto + local' );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->content, 'abort end', 'Content OK' );
+ }
+
+ # test auto + default (bug on invocation of default twice)
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Auto::Default->begin
+ TestApp::Controller::Action::Auto->auto
+ TestApp::Controller::Action::Auto::Default->auto
+ TestApp::Controller::Action::Auto::Default->default
+ TestApp::Controller::Action::Auto::Default->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/action/auto/default/moose'), 'auto + default' );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->content, 'default (auto: 1)', 'Content OK' );
+ }
+}
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_component_controller_action_auto.t
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_component_controller_action_begin.t
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_component_controller_action_begin.t (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_component_controller_action_begin.t 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,53 @@
+#!perl
+
+use strict;
+use warnings;
+
+use FindBin;
+use lib "$FindBin::Bin/../lib";
+
+our $iters;
+
+BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; }
+
+use Test::More tests => 7*$iters;
+use Catalyst::Test 'TestApp';
+
+if ( $ENV{CAT_BENCHMARK} ) {
+ require Benchmark;
+ Benchmark::timethis( $iters, \&run_tests );
+}
+else {
+ for ( 1 .. $iters ) {
+ run_tests();
+ }
+}
+
+sub run_tests {
+
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Begin->begin
+ TestApp::Controller::Action::Begin->default
+ TestApp::View::Dump::Request->process
+ TestApp->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/action/begin'),
+ 'Request' );
+ 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::Begin',
+ 'Test Class'
+ );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ like( $response->content, qr/'Catalyst::Request'/,
+ 'Content is a serialized Catalyst::Request' );
+ }
+}
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_component_controller_action_begin.t
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_component_controller_action_chained.t
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_component_controller_action_chained.t (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_component_controller_action_chained.t 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,984 @@
+#!perl
+
+use strict;
+use warnings;
+
+use FindBin;
+use lib "$FindBin::Bin/../lib";
+
+our $iters;
+
+BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; }
+
+use Test::More tests => 141*$iters;
+use Catalyst::Test 'TestApp';
+
+if ( $ENV{CAT_BENCHMARK} ) {
+ require Benchmark;
+ Benchmark::timethis( $iters, \&run_tests );
+}
+else {
+ for ( 1 .. $iters ) {
+ run_tests($_);
+ }
+}
+
+sub run_tests {
+ my ($run_number) = @_;
+
+ #
+ # This is a simple test where the parent and child actions are
+ # within the same controller.
+ #
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Chained->begin
+ TestApp::Controller::Action::Chained->foo
+ TestApp::Controller::Action::Chained->endpoint
+ TestApp::Controller::Action::Chained->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/chained/foo/1/end/2'), 'chained + local endpoint' );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->content, '1; 2', 'Content OK' );
+ }
+
+ #
+ # This makes sure the above isn't found if the argument for the
+ # end action isn't supplied.
+ #
+ {
+ my $expected = undef;
+
+ ok( my $response = request('http://localhost/chained/foo/1/end'),
+ 'chained + local endpoint; missing last argument' );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->code, 500, 'Status OK' );
+ }
+
+ #
+ # Tests the case when the child action is placed in a subcontroller.
+ #
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Chained->begin
+ TestApp::Controller::Action::Chained->foo
+ TestApp::Controller::Action::Chained::Foo->spoon
+ TestApp::Controller::Action::Chained->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/chained/foo/1/spoon'), 'chained + subcontroller endpoint' );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->content, '1; ', 'Content OK' );
+ }
+
+ #
+ # Tests if the relative specification (e.g.: Chained('bar') ) works
+ # as expected.
+ #
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Chained->begin
+ TestApp::Controller::Action::Chained->bar
+ TestApp::Controller::Action::Chained->finale
+ TestApp::Controller::Action::Chained->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/chained/bar/1/spoon'), 'chained + relative endpoint' );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->content, '; 1, spoon', 'Content OK' );
+ }
+
+ #
+ # Just a test for multiple arguments.
+ #
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Chained->begin
+ TestApp::Controller::Action::Chained->foo2
+ TestApp::Controller::Action::Chained->endpoint2
+ TestApp::Controller::Action::Chained->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/chained/foo2/10/20/end2/15/25'),
+ 'chained + local (2 args each)' );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->content, '10, 20; 15, 25', 'Content OK' );
+ }
+
+ #
+ # The first three-chain test tries to call the action with :Args(1)
+ # specification. There's also a one action with a :CaptureArgs(1)
+ # attribute, that should not be dispatched to.
+ #
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Chained->begin
+ TestApp::Controller::Action::Chained->one_end
+ TestApp::Controller::Action::Chained->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/chained/one/23'),
+ 'three-chain (only first)' );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->content, '; 23', 'Content OK' );
+ }
+
+ #
+ # This is the second three-chain test, it goes for the action that
+ # handles "/one/$cap/two/$arg1/$arg2" paths. Should be the two action
+ # having :Args(2), not the one having :CaptureArgs(2).
+ #
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Chained->begin
+ TestApp::Controller::Action::Chained->one
+ TestApp::Controller::Action::Chained->two_end
+ TestApp::Controller::Action::Chained->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/chained/one/23/two/23/46'),
+ 'three-chain (up to second)' );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->content, '23; 23, 46', 'Content OK' );
+ }
+
+ #
+ # Last of the three-chain tests. Has no concurrent action with :CaptureArgs
+ # and is more thought to simply test the chain as a whole and the 'two'
+ # action specifying :CaptureArgs.
+ #
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Chained->begin
+ TestApp::Controller::Action::Chained->one
+ TestApp::Controller::Action::Chained->two
+ TestApp::Controller::Action::Chained->three_end
+ TestApp::Controller::Action::Chained->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/chained/one/23/two/23/46/three/1/2/3'),
+ 'three-chain (all three)' );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->content, '23, 23, 46; 1, 2, 3', 'Content OK' );
+ }
+
+ #
+ # Tests dispatching on number of arguments for :Args. This should be
+ # dispatched to the action expecting one argument.
+ #
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Chained->begin
+ TestApp::Controller::Action::Chained->multi1
+ TestApp::Controller::Action::Chained->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/chained/multi/23'),
+ 'multi-action (one arg)' );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->content, '; 23', 'Content OK' );
+ }
+
+ #
+ # Belongs to the former test and goes for the action expecting two arguments.
+ #
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Chained->begin
+ TestApp::Controller::Action::Chained->multi2
+ TestApp::Controller::Action::Chained->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/chained/multi/23/46'),
+ 'multi-action (two args)' );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->content, '; 23, 46', 'Content OK' );
+ }
+
+ #
+ # Dispatching on argument count again, this time we provide too many
+ # arguments, so dispatching should fail.
+ #
+ {
+ my $expected = undef;
+
+ ok( my $response = request('http://localhost/chained/multi/23/46/67'),
+ 'multi-action (three args, should lead to error)' );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->code, 500, 'Status OK' );
+ }
+
+ #
+ # This tests the case when an action says it's the child of an action in
+ # a subcontroller.
+ #
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Chained->begin
+ TestApp::Controller::Action::Chained::Foo->higher_root
+ TestApp::Controller::Action::Chained->higher_root
+ TestApp::Controller::Action::Chained->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/chained/higher_root/23/bar/11'),
+ 'root higher than child' );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->content, '23; 11', 'Content OK' );
+ }
+
+ #
+ # Just a more complex version of the former test. It tests if a controller ->
+ # subcontroller -> controller dispatch works.
+ #
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Chained->begin
+ TestApp::Controller::Action::Chained->pcp1
+ TestApp::Controller::Action::Chained::Foo->pcp2
+ TestApp::Controller::Action::Chained->pcp3
+ TestApp::Controller::Action::Chained->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/chained/pcp1/1/pcp2/2/pcp3/3'),
+ 'parent -> child -> parent' );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->content, '1, 2; 3', 'Content OK' );
+ }
+
+ #
+ # Tests dispatch on capture number. This test is for a one capture action.
+ #
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Chained->begin
+ TestApp::Controller::Action::Chained->multi_cap1
+ TestApp::Controller::Action::Chained->multi_cap_end1
+ TestApp::Controller::Action::Chained->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/chained/multi_cap/1/baz'),
+ 'dispatch on capture num 1' );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->content, '1; ', 'Content OK' );
+ }
+
+ #
+ # Belongs to the former test. This one goes for the action expecting two
+ # captures.
+ #
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Chained->begin
+ TestApp::Controller::Action::Chained->multi_cap2
+ TestApp::Controller::Action::Chained->multi_cap_end2
+ TestApp::Controller::Action::Chained->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/chained/multi_cap/1/2/baz'),
+ 'dispatch on capture num 2' );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->content, '1, 2; ', 'Content OK' );
+ }
+
+ #
+ # Tests the priority of a slurpy arguments action (with :Args) against
+ # two actions chained together. The two actions should win.
+ #
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Chained->begin
+ TestApp::Controller::Action::Chained->priority_a2
+ TestApp::Controller::Action::Chained->priority_a2_end
+ TestApp::Controller::Action::Chained->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/chained/priority_a/1/end/2'),
+ 'priority - slurpy args vs. parent/child' );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->content, '1; 2', 'Content OK' );
+ }
+
+ #
+ # This belongs to the former test but tests if two chained actions have
+ # priority over an action with the exact arguments.
+ #
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Chained->begin
+ TestApp::Controller::Action::Chained->priority_b2
+ TestApp::Controller::Action::Chained->priority_b2_end
+ TestApp::Controller::Action::Chained->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/chained/priority_b/1/end/2'),
+ 'priority - fixed args vs. parent/child' );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->content, '1; 2', 'Content OK' );
+ }
+
+ #
+ # This belongs to the former test but tests if two chained actions have
+ # priority over an action with one child action not having the Args() attr set.
+ #
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Chained->begin
+ TestApp::Controller::Action::Chained->priority_c1
+ TestApp::Controller::Action::Chained->priority_c2_xyz
+ TestApp::Controller::Action::Chained->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/chained/priority_c/1/xyz/'),
+ 'priority - no Args() order mismatch' );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->content, '1; ', 'Content OK' );
+ }
+
+ #
+ # Test dispatching between two controllers that are on the same level and
+ # therefor have no parent/child relationship.
+ #
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Chained->begin
+ TestApp::Controller::Action::Chained::Bar->cross1
+ TestApp::Controller::Action::Chained::Foo->cross2
+ TestApp::Controller::Action::Chained->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/chained/cross/1/end/2'),
+ 'cross controller w/o par/child relation' );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->content, '1; 2', 'Content OK' );
+ }
+
+ #
+ # This is for testing if the arguments got passed to the actions
+ # correctly.
+ #
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Chained->begin
+ TestApp::Controller::Action::Chained::PassedArgs->first
+ TestApp::Controller::Action::Chained::PassedArgs->second
+ TestApp::Controller::Action::Chained::PassedArgs->third
+ TestApp::Controller::Action::Chained::PassedArgs->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/chained/passedargs/a/1/b/2/c/3'),
+ 'Correct arguments passed to actions' );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->content, '1; 2; 3', 'Content OK' );
+ }
+
+ #
+ # The :Args attribute is optional, we check the action not specifying
+ # it with these tests.
+ #
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Chained->begin
+ TestApp::Controller::Action::Chained->opt_args
+ TestApp::Controller::Action::Chained->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/chained/opt_args/1/2/3'),
+ 'Optional :Args attribute working' );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->content, '; 1, 2, 3', 'Content OK' );
+ }
+
+ #
+ # Tests for optional PathPart attribute.
+ #
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Chained->begin
+ TestApp::Controller::Action::Chained->opt_pp_start
+ TestApp::Controller::Action::Chained->opt_pathpart
+ TestApp::Controller::Action::Chained->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/chained/optpp/1/opt_pathpart/2'),
+ 'Optional :PathName attribute working' );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->content, '1; 2', 'Content OK' );
+ }
+
+ #
+ # Tests for optional PathPart *and* Args attributes.
+ #
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Chained->begin
+ TestApp::Controller::Action::Chained->opt_all_start
+ TestApp::Controller::Action::Chained->oa
+ TestApp::Controller::Action::Chained->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/chained/optall/1/oa/2/3'),
+ 'Optional :PathName *and* :Args attributes working' );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->content, '1; 2, 3', 'Content OK' );
+ }
+
+ #
+ # Test if :Chained is the same as :Chained('/')
+ #
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Chained->begin
+ TestApp::Controller::Action::Chained->rootdef
+ TestApp::Controller::Action::Chained->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/chained/rootdef/23'),
+ ":Chained is the same as :Chained('/')" );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->content, '; 23', 'Content OK' );
+ }
+
+ #
+ # Test if :Chained('.') is working
+ #
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Chained->begin
+ TestApp::Controller::Action::Chained->parentchain
+ TestApp::Controller::Action::Chained::ParentChain->child
+ TestApp::Controller::Action::Chained->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/chained/parentchain/1/child/2'),
+ ":Chained('.') chains to parent controller action" );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->content, '1; 2', 'Content OK' );
+ }
+
+ #
+ # Test if :Chained('../act') is working
+ #
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Chained->begin
+ TestApp::Controller::Action::Chained->one
+ TestApp::Controller::Action::Chained::ParentChain->chained_rel
+ TestApp::Controller::Action::Chained->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/chained/one/1/chained_rel/3/2'),
+ ":Chained('../action') chains to correct action" );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->content, '1; 3, 2', 'Content OK' );
+ }
+
+ #
+ # Test if ../ works to go up more than one level
+ #
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Chained->begin
+ TestApp::Controller::Action::Chained->one
+ TestApp::Controller::Action::Chained::ParentChain::Relative->chained_rel_two
+ TestApp::Controller::Action::Chained->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/chained/one/1/chained_rel_two/42/23'),
+ "../ works to go up more than one level" );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->content, '1; 42, 23', 'Content OK' );
+ }
+
+ #
+ # Test if :ChainedParent is working
+ #
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Chained->begin
+ TestApp::Controller::Action::Chained->loose
+ TestApp::Controller::Action::Chained::ParentChain->loose
+ TestApp::Controller::Action::Chained->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/chained/loose/4/loose/a/b'),
+ ":Chained('../action') chains to correct action" );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->content, '4; a, b', 'Content OK' );
+ }
+
+ #
+ # Test if :Chained('../name/act') is working
+ #
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Chained->begin
+ TestApp::Controller::Action::Chained::Bar->cross1
+ TestApp::Controller::Action::Chained::ParentChain->up_down
+ TestApp::Controller::Action::Chained->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/chained/cross/4/up_down/5'),
+ ":Chained('../action') chains to correct action" );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->content, '4; 5', 'Content OK' );
+ }
+
+ #
+ # Test behaviour of auto actions returning '1' for the chain.
+ #
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Chained->begin
+ TestApp::Controller::Action::Chained::Auto->auto
+ TestApp::Controller::Action::Chained::Auto::Foo->auto
+ TestApp::Controller::Action::Chained::Auto->foo
+ TestApp::Controller::Action::Chained::Auto::Foo->fooend
+ TestApp::Controller::Action::Chained->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/chained/autochain1/1/fooend/2'),
+ "Behaviour when auto returns 1 correct" );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->content, '1; 2', 'Content OK' );
+ }
+
+ #
+ # Test behaviour of auto actions returning '0' for the chain.
+ #
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Chained->begin
+ TestApp::Controller::Action::Chained::Auto->auto
+ TestApp::Controller::Action::Chained::Auto::Bar->auto
+ TestApp::Controller::Action::Chained->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/chained/autochain2/1/barend/2'),
+ "Behaviour when auto returns 0 correct" );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->content, '1; 2', 'Content OK' );
+ }
+
+ #
+ # Test what auto actions are run when namespaces are changed
+ # horizontally.
+ #
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Chained->begin
+ TestApp::Controller::Action::Chained::Auto->auto
+ TestApp::Controller::Action::Chained::Auto::Foo->auto
+ TestApp::Controller::Action::Chained::Auto::Bar->crossloose
+ TestApp::Controller::Action::Chained::Auto::Foo->crossend
+ TestApp::Controller::Action::Chained->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/chained/auto_cross/1/crossend/2'),
+ "Correct auto actions are run on cross controller dispatch" );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->content, '1; 2', 'Content OK' );
+ }
+
+ #
+ # Test forwarding from auto action in chain dispatch.
+ #
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Chained->begin
+ TestApp::Controller::Action::Chained::Auto->auto
+ TestApp::Controller::Action::Chained::Auto::Forward->auto
+ TestApp::Controller::Action::Chained::Auto->fw3
+ TestApp::Controller::Action::Chained::Auto->fw1
+ TestApp::Controller::Action::Chained::Auto::Forward->forwardend
+ TestApp::Controller::Action::Chained->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/chained/auto_forward/1/forwardend/2'),
+ "Forwarding out of auto in chain" );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->content, '1; 2', 'Content OK' );
+ }
+
+ #
+ # Detaching out of the auto action of a chain.
+ #
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Chained->begin
+ TestApp::Controller::Action::Chained::Auto->auto
+ TestApp::Controller::Action::Chained::Auto::Detach->auto
+ TestApp::Controller::Action::Chained::Auto->fw3
+ TestApp::Controller::Action::Chained->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/chained/auto_detach/1/detachend/2'),
+ "Detaching out of auto in chain" );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->content, '1; 2', 'Content OK' );
+ }
+
+ #
+ # Test forwarding from auto action in chain dispatch.
+ #
+ {
+ my $expected = undef;
+
+ ok( my $response = request('http://localhost/chained/loose/23'),
+ "Loose end is not callable" );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->code, 500, 'Status OK' );
+ }
+
+ #
+ # Test forwarding out of a chain.
+ #
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Chained->begin
+ TestApp::Controller::Action::Chained->chain_fw_a
+ TestApp::Controller::Action::Chained->fw_dt_target
+ TestApp::Controller::Action::Chained->chain_fw_b
+ TestApp::Controller::Action::Chained->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/chained/chain_fw/1/end/2'),
+ "Forwarding out a chain" );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->content, '1; 2', 'Content OK' );
+ }
+
+ #
+ # Test detaching out of a chain.
+ #
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Chained->begin
+ TestApp::Controller::Action::Chained->chain_dt_a
+ TestApp::Controller::Action::Chained->fw_dt_target
+ TestApp::Controller::Action::Chained->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/chained/chain_dt/1/end/2'),
+ "Forwarding out a chain" );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->content, '1; 2', 'Content OK' );
+ }
+
+ #
+ # Tests that an uri_for to a chained root index action
+ # returns the right value.
+ #
+ {
+ ok( my $response = request(
+ 'http://localhost/action/chained/to_root' ),
+ 'uri_for with chained root action as arg' );
+ like( $response->content,
+ qr(URI:https?://[^/]+/),
+ 'Correct URI generated' );
+ }
+
+ #
+ # Test interception of recursive chains. This test was added because at
+ # one point during the :Chained development, Catalyst used to hang on
+ # recursive chains.
+ #
+ {
+ eval { require 'TestAppChainedRecursive.pm' };
+ if ($run_number == 1) {
+ ok( ! $@, "Interception of recursive chains" );
+ }
+ else { pass( "Interception of recursive chains already tested" ) }
+ }
+
+ #
+ # Test failure of absolute path part arguments.
+ #
+ {
+ eval { require 'TestAppChainedAbsolutePathPart.pm' };
+ if ($run_number == 1) {
+ like( $@, qr(foo/foo),
+ "Usage of absolute path part argument emits error" );
+ }
+ else { pass( "Error on absolute path part arguments already tested" ) }
+ }
+
+ #
+ # Test chained actions in the root controller
+ #
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Chained::Root->rootsub
+ TestApp::Controller::Action::Chained::Root->endpointsub
+ TestApp->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/rootsub/1/endpointsub/2'), 'chained in root namespace' );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->content, '', 'Content OK' );
+ }
+
+ #
+ # Complex path with multiple empty pathparts
+ #
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Chained->begin
+ TestApp::Controller::Action::Chained->mult_nopp_base
+ TestApp::Controller::Action::Chained->mult_nopp_all
+ TestApp::Controller::Action::Chained->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/chained/mult_nopp'),
+ "Complex path with multiple empty pathparts" );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->content, '; ', 'Content OK' );
+ }
+
+ #
+ # Higher Args() hiding more specific CaptureArgs chains sections
+ #
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Chained->begin
+ TestApp::Controller::Action::Chained->cc_base
+ TestApp::Controller::Action::Chained->cc_link
+ TestApp::Controller::Action::Chained->cc_anchor
+ TestApp::Controller::Action::Chained->end
+ ];
+
+ my $expected = join ', ', @expected;
+
+ ok( my $response = request('http://localhost/chained/choose_capture/anchor.html'),
+ 'Choose between an early Args() and a later more ideal chain' );
+ is( $response->header('X-Catalyst-Executed') => $expected, 'Executed actions');
+ is( $response->content => '; ', 'Content OK' );
+ }
+
+ #
+ # Less specific chain not being seen correctly due to earlier looser capture
+ #
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Chained->begin
+ TestApp::Controller::Action::Chained->cc_base
+ TestApp::Controller::Action::Chained->cc_b
+ TestApp::Controller::Action::Chained->cc_b_link
+ TestApp::Controller::Action::Chained->cc_b_anchor
+ TestApp::Controller::Action::Chained->end
+ ];
+
+ my $expected = join ', ', @expected;
+
+ ok( my $response = request('http://localhost/chained/choose_capture/b/a/anchor.html'),
+ 'Choose between a more specific chain and an earlier looser one' );
+ is( $response->header('X-Catalyst-Executed') => $expected, 'Executed actions');
+ is( $response->content => 'a; ', 'Content OK' );
+ }
+
+ #
+ # Check we get the looser one when it's the correct match
+ #
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Chained->begin
+ TestApp::Controller::Action::Chained->cc_base
+ TestApp::Controller::Action::Chained->cc_a
+ TestApp::Controller::Action::Chained->cc_a_link
+ TestApp::Controller::Action::Chained->cc_a_anchor
+ TestApp::Controller::Action::Chained->end
+ ];
+
+ my $expected = join ', ', @expected;
+
+ ok( my $response = request('http://localhost/chained/choose_capture/a/a/anchor.html'),
+ 'Choose between a more specific chain and an earlier looser one' );
+ is( $response->header('X-Catalyst-Executed') => $expected, 'Executed actions');
+ is( $response->content => 'a; anchor.html', 'Content OK' );
+ }
+
+ #
+ # Args(0) should win over Args() if we actually have no arguments.
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Chained->begin
+ TestApp::Controller::Action::Chained::ArgsOrder->base
+ TestApp::Controller::Action::Chained::ArgsOrder->index
+ TestApp::Controller::Action::Chained::ArgsOrder->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ # With no args, we should run "index"
+ ok( my $response = request('http://localhost/argsorder/'),
+ 'Correct arg order ran' );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->content, 'base; ; index; ', 'Content OK' );
+
+ # With args given, run "all"
+ ok( $response = request('http://localhost/argsorder/X'),
+ 'Correct arg order ran' );
+ is( $response->header('X-Catalyst-Executed'),
+ join(", ",
+ qw[
+ TestApp::Controller::Action::Chained->begin
+ TestApp::Controller::Action::Chained::ArgsOrder->base
+ TestApp::Controller::Action::Chained::ArgsOrder->all
+ TestApp::Controller::Action::Chained::ArgsOrder->end
+ ])
+ );
+ is( $response->content, 'base; ; all; X', 'Content OK' );
+
+ }
+
+ #
+ # PathPrefix
+ #
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Chained->begin
+ TestApp::Controller::Action::Chained::PathPrefix->instance
+ TestApp::Controller::Action::Chained->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/action/chained/pathprefix/1'),
+ "PathPrefix (as an endpoint)" );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->content, '; 1', 'Content OK' );
+ }
+
+ #
+ # static paths vs. captures
+ #
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Chained->begin
+ TestApp::Controller::Action::Chained->apan
+ TestApp::Controller::Action::Chained->korv
+ TestApp::Controller::Action::Chained->static_end
+ TestApp::Controller::Action::Chained->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/action/chained/static_end'),
+ "static paths are prefered over captures" );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ }
+}
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_component_controller_action_chained.t
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_component_controller_action_default.t
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_component_controller_action_default.t (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_component_controller_action_default.t 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,96 @@
+#!perl
+
+use strict;
+use warnings;
+
+use FindBin;
+use lib "$FindBin::Bin/../lib";
+
+our $iters;
+
+BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; }
+
+use Test::More tests => 16 * $iters;
+use Catalyst::Test 'TestApp';
+
+if ( $ENV{CAT_BENCHMARK} ) {
+ require Benchmark;
+ Benchmark::timethis( $iters, \&run_tests );
+}
+else {
+ for ( 1 .. $iters ) {
+ run_tests();
+ }
+}
+
+sub run_tests {
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Default->begin
+ TestApp::Controller::Action::Default->default
+ TestApp::View::Dump::Request->process
+ TestApp->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/action/default'),
+ 'Request' );
+ 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::Default',
+ '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'
+ );
+
+ ok( $response = request('http://localhost/foo/bar/action'), 'Request' );
+ is( $response->code, 500, 'Invalid URI returned 500' );
+ }
+
+ # test that args are passed properly to default
+ {
+ my $creq;
+ my $expected = [qw/action default arg1 arg2/];
+
+ ok( my $response = request('http://localhost/action/default/arg1/arg2'),
+ 'Request' );
+ ok(
+ eval '$creq = ' . $response->content,
+ 'Unserialize Catalyst::Request'
+ );
+ is_deeply( $creq->{arguments}, $expected, 'Arguments ok' );
+ }
+
+
+ # Test that /foo and /foo/ both do the same thing
+ {
+ my @expected = qw[
+ TestApp::Controller::Action->begin
+ TestApp::Controller::Action->default
+ TestApp->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/action'), 'Request' );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected,
+ 'Executed actions for /action'
+ );
+
+ ok( $response = request('http://localhost/action/'), 'Request' );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected,
+ 'Executed actions for /action/'
+ );
+ }
+}
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_component_controller_action_default.t
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_component_controller_action_detach.t
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_component_controller_action_detach.t (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_component_controller_action_detach.t 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,100 @@
+#!perl
+
+use strict;
+use warnings;
+
+use FindBin;
+use lib "$FindBin::Bin/../lib";
+
+our $iters;
+
+BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; }
+
+use Test::More tests => 18*$iters;
+use Catalyst::Test 'TestApp';
+
+if ( $ENV{CAT_BENCHMARK} ) {
+ require Benchmark;
+ Benchmark::timethis( $iters, \&run_tests );
+}
+else {
+ for ( 1 .. $iters ) {
+ run_tests();
+ }
+}
+
+sub run_tests {
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Detach->begin
+ TestApp::Controller::Action::Detach->one
+ TestApp::Controller::Action::Detach->two
+ TestApp::View::Dump::Request->process
+ TestApp->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ # Test detach to chain of actions.
+ ok( my $response = request('http://localhost/action/detach/one'),
+ 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ is( $response->header('X-Catalyst-Action'),
+ 'action/detach/one', 'Test Action' );
+ is(
+ $response->header('X-Test-Class'),
+ 'TestApp::Controller::Action::Detach',
+ 'Test Class'
+ );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ }
+
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Detach->begin
+ TestApp::Controller::Action::Detach->path
+ TestApp::Controller::Action::Detach->two
+ TestApp::View::Dump::Request->process
+ TestApp->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ # Test detach to chain of actions.
+ ok( my $response = request('http://localhost/action/detach/path'),
+ 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ is( $response->header('X-Catalyst-Action'),
+ 'action/detach/path', 'Test Action' );
+ is(
+ $response->header('X-Test-Class'),
+ 'TestApp::Controller::Action::Detach',
+ 'Test Class'
+ );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ }
+
+ {
+ ok(
+ my $response =
+ request('http://localhost/action/detach/with_args/old'),
+ 'Request with args'
+ );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content, 'new' );
+ }
+
+ {
+ ok(
+ my $response = request(
+ 'http://localhost/action/detach/with_method_and_args/old'),
+ 'Request with args and method'
+ );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content, 'new' );
+ }
+}
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_component_controller_action_detach.t
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_component_controller_action_end.t
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_component_controller_action_end.t (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_component_controller_action_end.t 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,54 @@
+#!perl
+
+use strict;
+use warnings;
+
+use FindBin;
+use lib "$FindBin::Bin/../lib";
+
+our $iters;
+
+BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; }
+
+use Test::More tests => 7*$iters;
+use Catalyst::Test 'TestApp';
+
+if ( $ENV{CAT_BENCHMARK} ) {
+ require 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( my $response = request('http://localhost/action/end'), 'Request' );
+ 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'
+ );
+ }
+}
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_component_controller_action_end.t
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_component_controller_action_forward.t
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_component_controller_action_forward.t (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_component_controller_action_forward.t 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,248 @@
+#!perl
+
+use strict;
+use warnings;
+
+use FindBin;
+use lib "$FindBin::Bin/../lib";
+
+our $iters;
+
+BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; }
+
+use Test::More tests => 50 * $iters;
+use Catalyst::Test 'TestApp';
+
+if ( $ENV{CAT_BENCHMARK} ) {
+ require Benchmark;
+ Benchmark::timethis( $iters, \&run_tests );
+}
+else {
+ for ( 1 .. $iters ) {
+ run_tests();
+ }
+}
+
+sub run_tests {
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Forward->begin
+ TestApp::Controller::Action::Forward->one
+ TestApp::Controller::Action::Forward->two
+ TestApp::Controller::Action::Forward->three
+ TestApp::Controller::Action::Forward->four
+ TestApp::Controller::Action::Forward->five
+ TestApp::View::Dump::Request->process
+ TestApp->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ # Test forward to global private action
+ ok( my $response = request('http://localhost/action/forward/global'),
+ 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ is( $response->header('X-Catalyst-Action'),
+ 'action/forward/global', 'Main Class Action' );
+
+ # Test forward to chain of actions.
+ ok( $response = request('http://localhost/action/forward/one'),
+ 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ is( $response->header('X-Catalyst-Action'),
+ 'action/forward/one', 'Test Action' );
+ is(
+ $response->header('X-Test-Class'),
+ 'TestApp::Controller::Action::Forward',
+ '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'
+ );
+ }
+
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Forward->begin
+ TestApp::Controller::Action::Forward->jojo
+ TestApp::Controller::Action::Forward->one
+ TestApp::Controller::Action::Forward->two
+ TestApp::Controller::Action::Forward->three
+ TestApp::Controller::Action::Forward->four
+ TestApp::Controller::Action::Forward->five
+ TestApp::View::Dump::Request->process
+ TestApp::Controller::Action::Forward->three
+ TestApp::Controller::Action::Forward->four
+ TestApp::Controller::Action::Forward->five
+ TestApp::View::Dump::Request->process
+ TestApp->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/action/forward/jojo'),
+ 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ is( $response->header('X-Catalyst-Action'),
+ 'action/forward/jojo', 'Test Action' );
+ is(
+ $response->header('X-Test-Class'),
+ 'TestApp::Controller::Action::Forward',
+ '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'
+ );
+ }
+
+ {
+ ok(
+ my $response =
+ request('http://localhost/action/forward/with_args/old'),
+ 'Request with args'
+ );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content, 'old' );
+ }
+
+ {
+ ok(
+ my $response = request(
+ 'http://localhost/action/forward/with_method_and_args/old'),
+ 'Request with args and method'
+ );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content, 'old' );
+ }
+
+ # test forward with embedded args
+ {
+ ok(
+ my $response =
+ request('http://localhost/action/forward/args_embed_relative'),
+ 'Request'
+ );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content, 'ok' );
+ }
+
+ {
+ ok(
+ my $response =
+ request('http://localhost/action/forward/args_embed_absolute'),
+ 'Request'
+ );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content, 'ok' );
+ }
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::TestRelative->begin
+ TestApp::Controller::Action::TestRelative->relative
+ TestApp::Controller::Action::Forward->one
+ TestApp::Controller::Action::Forward->two
+ TestApp::Controller::Action::Forward->three
+ TestApp::Controller::Action::Forward->four
+ TestApp::Controller::Action::Forward->five
+ TestApp::View::Dump::Request->process
+ TestApp->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ # Test forward to chain of actions.
+ ok( my $response = request('http://localhost/action/relative/relative'),
+ 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ is( $response->header('X-Catalyst-Action'),
+ 'action/relative/relative', 'Test Action' );
+ is(
+ $response->header('X-Test-Class'),
+ 'TestApp::Controller::Action::TestRelative',
+ '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'
+ );
+ }
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::TestRelative->begin
+ TestApp::Controller::Action::TestRelative->relative_two
+ TestApp::Controller::Action::Forward->one
+ TestApp::Controller::Action::Forward->two
+ TestApp::Controller::Action::Forward->three
+ TestApp::Controller::Action::Forward->four
+ TestApp::Controller::Action::Forward->five
+ TestApp::View::Dump::Request->process
+ TestApp->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ # Test forward to chain of actions.
+ ok(
+ my $response =
+ request('http://localhost/action/relative/relative_two'),
+ 'Request'
+ );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ is(
+ $response->header('X-Catalyst-Action'),
+ 'action/relative/relative_two',
+ 'Test Action'
+ );
+ is(
+ $response->header('X-Test-Class'),
+ 'TestApp::Controller::Action::TestRelative',
+ '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'
+ );
+ }
+
+ # test class forwards
+ {
+ ok(
+ my $response = request(
+ 'http://localhost/action/forward/class_forward_test_action'),
+ 'Request'
+ );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->header('X-Class-Forward-Test-Method'), 1,
+ 'Test Method' );
+ }
+
+ # test uri_for re r7385
+ {
+ ok( my $response = request(
+ 'http://localhost/action/forward/forward_to_uri_check'),
+ 'forward_to_uri_check request');
+
+ ok( $response->is_success, 'forward_to_uri_check successful');
+ is( $response->content, '/action/forward/foo/bar',
+ 'forward_to_uri_check correct namespace');
+ }
+}
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_component_controller_action_forward.t
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_component_controller_action_global.t
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_component_controller_action_global.t (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_component_controller_action_global.t 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,83 @@
+#!perl
+
+use strict;
+use warnings;
+
+use FindBin;
+use lib "$FindBin::Bin/../lib";
+
+our $iters;
+
+BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; }
+
+use Test::More tests => 18*$iters;
+use Catalyst::Test 'TestApp';
+
+if ( $ENV{CAT_BENCHMARK} ) {
+ require Benchmark;
+ Benchmark::timethis( $iters, \&run_tests );
+}
+else {
+ for ( 1 .. $iters ) {
+ run_tests();
+ }
+}
+
+sub run_tests {
+ {
+ ok( my $response = request('http://localhost/action_global_one'),
+ 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ is( $response->header('X-Catalyst-Action'),
+ 'action_global_one', 'Test Action' );
+ is(
+ $response->header('X-Test-Class'),
+ 'TestApp::Controller::Action::Global',
+ 'Test Class'
+ );
+ like(
+ $response->content,
+ qr/^bless\( .* 'Catalyst::Request' \)$/s,
+ 'Content is a serialized Catalyst::Request'
+ );
+ }
+
+ {
+ ok( my $response = request('http://localhost/action_global_two'),
+ 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ is( $response->header('X-Catalyst-Action'),
+ 'action_global_two', 'Test Action' );
+ is(
+ $response->header('X-Test-Class'),
+ 'TestApp::Controller::Action::Global',
+ 'Test Class'
+ );
+ like(
+ $response->content,
+ qr/^bless\( .* 'Catalyst::Request' \)$/s,
+ 'Content is a serialized Catalyst::Request'
+ );
+ }
+
+ {
+ ok( my $response = request('http://localhost/action_global_three'),
+ 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ is( $response->header('X-Catalyst-Action'),
+ 'action_global_three', 'Test Action' );
+ is(
+ $response->header('X-Test-Class'),
+ 'TestApp::Controller::Action::Global',
+ 'Test Class'
+ );
+ like(
+ $response->content,
+ qr/^bless\( .* 'Catalyst::Request' \)$/s,
+ 'Content is a serialized Catalyst::Request'
+ );
+ }
+}
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_component_controller_action_global.t
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_component_controller_action_go.t
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_component_controller_action_go.t (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_component_controller_action_go.t 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,277 @@
+#!perl
+
+use strict;
+use warnings;
+
+use FindBin;
+use lib "$FindBin::Bin/../lib";
+
+our $iters;
+
+BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; }
+
+use Test::More tests => 54 * $iters;
+use Catalyst;
+use Catalyst::Test 'TestApp';
+
+if ( $ENV{CAT_BENCHMARK} ) {
+ require Benchmark;
+ Benchmark::timethis( $iters, \&run_tests );
+}
+else {
+ for ( 1 .. $iters ) {
+ run_tests();
+ }
+}
+
+sub run_tests {
+ {
+ # Test go to global private action
+ ok( my $response = request('http://localhost/action/go/global'),
+ 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ is( $response->header('X-Catalyst-Action'),
+ 'action/go/global', 'Main Class Action' );
+ }
+
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Go->one
+ TestApp::Controller::Action::Go->two
+ TestApp::Controller::Action::Go->three
+ TestApp::Controller::Action::Go->four
+ TestApp::Controller::Action::Go->five
+ TestApp::View::Dump::Request->process
+ TestApp->end
+ ];
+
+ @expected = map { /Action/ ? (_begin($_), $_) : ($_) } @expected;
+ my $expected = join( ", ", @expected );
+
+ # Test go to chain of actions.
+ ok( my $response = request('http://localhost/action/go/one'),
+ 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ is( $response->header('X-Catalyst-Action'),
+ 'action/go/one', 'Test Action' );
+ is(
+ $response->header('X-Test-Class'),
+ 'TestApp::Controller::Action::Go',
+ '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'
+ );
+ }
+
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Go->go_die
+ TestApp::Controller::Action::Go->args
+ TestApp->end
+ ];
+
+ @expected = map { /Action/ ? (_begin($_), $_) : ($_) } @expected;
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/action/go/go_die'),
+ 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ is( $response->header('X-Catalyst-Action'),
+ 'action/go/go_die', 'Test Action'
+ );
+ is(
+ $response->header('X-Test-Class'),
+ 'TestApp::Controller::Action::Go',
+ 'Test Class'
+ );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->content, $Catalyst::GO, "Go died as expected" );
+ }
+ {
+ ok(
+ my $response = request('http://localhost/action/go/model'),
+ 'Request with args'
+ );
+ is( $response->content,
+ q[FATAL ERROR: Couldn't go("Model::Foo"): Action cannot _DISPATCH. Did you try to go() a non-controller action?],
+ q[go('Model::...') test]
+ );
+ }
+ {
+ ok(
+ my $response = request('http://localhost/action/go/view'),
+ 'Request with args'
+ );
+ is( $response->content,
+ q[FATAL ERROR: Couldn't go("View::Dump"): Action cannot _DISPATCH. Did you try to go() a non-controller action?],
+ q[go('View::...') test]
+ );
+ }
+ {
+ ok(
+ my $response =
+ request('http://localhost/action/go/with_args/old'),
+ 'Request with args'
+ );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content, 'old', 'go() with args (old)' );
+ }
+
+ {
+ ok(
+ my $response = request(
+ 'http://localhost/action/go/with_method_and_args/new'),
+ 'Request with args and method'
+ );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content, 'new', 'go() with args (new)' );
+ }
+
+ # test go with embedded args
+ {
+ ok(
+ my $response =
+ request('http://localhost/action/go/args_embed_relative'),
+ 'Request'
+ );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content, 'ok', 'go() with args_embed_relative' );
+ }
+
+ {
+ ok(
+ my $response =
+ request('http://localhost/action/go/args_embed_absolute'),
+ 'Request'
+ );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content, 'ok', 'go() with args_embed_absolute' );
+ }
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::TestRelative->relative_go
+ TestApp::Controller::Action::Go->one
+ TestApp::Controller::Action::Go->two
+ TestApp::Controller::Action::Go->three
+ TestApp::Controller::Action::Go->four
+ TestApp::Controller::Action::Go->five
+ TestApp::View::Dump::Request->process
+ TestApp->end
+ ];
+
+ @expected = map { /Action/ ? (_begin($_), $_) : ($_) } @expected;
+ my $expected = join( ", ", @expected );
+
+ # Test go to chain of actions.
+ ok( my $response = request('http://localhost/action/relative/relative_go'),
+ 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ is( $response->header('X-Catalyst-Action'),
+ 'action/relative/relative_go', 'Test Action' );
+ is(
+ $response->header('X-Test-Class'),
+ 'TestApp::Controller::Action::Go',
+ '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'
+ );
+ }
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::TestRelative->relative_go_two
+ TestApp::Controller::Action::Go->one
+ TestApp::Controller::Action::Go->two
+ TestApp::Controller::Action::Go->three
+ TestApp::Controller::Action::Go->four
+ TestApp::Controller::Action::Go->five
+ TestApp::View::Dump::Request->process
+ TestApp->end
+ ];
+
+ @expected = map { /Action/ ? (_begin($_), $_) : ($_) } @expected;
+ my $expected = join( ", ", @expected );
+
+ # Test go to chain of actions.
+ ok(
+ my $response =
+ request('http://localhost/action/relative/relative_go_two'),
+ 'Request'
+ );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ is(
+ $response->header('X-Catalyst-Action'),
+ 'action/relative/relative_go_two',
+ 'Test Action'
+ );
+ is(
+ $response->header('X-Test-Class'),
+ 'TestApp::Controller::Action::Go',
+ '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'
+ );
+ }
+
+ # test class go -- MUST FAIL!
+ {
+ ok(
+ my $response = request(
+ 'http://localhost/action/go/class_go_test_action'),
+ 'Request'
+ );
+ ok( !$response->is_success, 'Response Fails' );
+ is( $response->content,
+ q(FATAL ERROR: Couldn't go("TestApp"): Action has no namespace: cannot go() to a plain method or component, must be a :Action or some sort.),
+ 'Error message'
+ );
+ }
+
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Go->begin
+ TestApp::Controller::Action::Go->go_chained
+ TestApp::Controller::Action::Chained->begin
+ TestApp::Controller::Action::Chained->foo
+ TestApp::Controller::Action::Chained::Foo->spoon
+ TestApp::Controller::Action::Chained->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/action/go/go_chained'), 'go to chained + subcontroller endpoint' );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->content, '; 1', 'Content OK' );
+ }
+
+}
+
+
+
+sub _begin {
+ local $_ = shift;
+ s/->(.*)$/->begin/;
+ return $_;
+}
+
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_component_controller_action_go.t
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_component_controller_action_index.t
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_component_controller_action_index.t (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_component_controller_action_index.t 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,100 @@
+#!perl
+
+use strict;
+use warnings;
+
+use FindBin;
+use lib "$FindBin::Bin/../lib";
+
+our $iters;
+
+BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; }
+
+use Test::More tests => 20*$iters;
+use Catalyst::Test 'TestApp';
+
+if ( $ENV{CAT_BENCHMARK} ) {
+ require Benchmark;
+ Benchmark::timethis( $iters, \&run_tests );
+}
+else {
+ for ( 1 .. $iters ) {
+ run_tests();
+ }
+}
+
+sub run_tests {
+ # test root index
+ {
+ my @expected = qw[
+ TestApp->index
+ TestApp->end
+ ];
+
+ my $expected = join( ", ", @expected );
+ ok( my $response = request('http://localhost/'), 'root index' );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->content, 'root index', 'root index ok' );
+
+ ok( $response = request('http://localhost'), 'root index no slash' );
+ is( $response->content, 'root index', 'root index no slash ok' );
+ }
+
+ # test first-level controller index
+ {
+ my @expected = qw[
+ TestApp::Controller::Index->index
+ TestApp->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/index/'), 'first-level controller index' );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->content, 'Index index', 'first-level controller index ok' );
+
+ ok( $response = request('http://localhost/index'), 'first-level controller index no slash' );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->content, 'Index index', 'first-level controller index no slash ok' );
+ }
+
+ # test second-level controller index
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Index->begin
+ TestApp::Controller::Action::Index->index
+ TestApp->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/action/index/'), 'second-level controller index' );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->content, 'Action-Index index', 'second-level controller index ok' );
+
+ ok( $response = request('http://localhost/action/index'), 'second-level controller index no slash' );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->content, 'Action-Index index', 'second-level controller index no slash ok' );
+ }
+
+ # test controller default when index is present
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Index->begin
+ TestApp::Controller::Action::Index->default
+ TestApp->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/action/index/foo'), 'default with index' );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->content, "Error - TestApp::Controller::Action\n", 'default with index ok' );
+ }
+}
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_component_controller_action_index.t
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_component_controller_action_inheritance.t
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_component_controller_action_inheritance.t (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_component_controller_action_inheritance.t 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,119 @@
+#!perl
+
+use strict;
+use warnings;
+
+use FindBin;
+use lib "$FindBin::Bin/../lib";
+
+our $iters;
+
+BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; }
+
+use Test::More tests => 21*$iters;
+use Catalyst::Test 'TestApp';
+
+if ( $ENV{CAT_BENCHMARK} ) {
+ require Benchmark;
+ Benchmark::timethis( $iters, \&run_tests );
+}
+else {
+ for ( 1 .. $iters ) {
+ run_tests();
+ }
+}
+
+sub run_tests {
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Inheritance->begin
+ TestApp::Controller::Action::Inheritance->auto
+ TestApp::Controller::Action::Inheritance->default
+ TestApp::View::Dump::Request->process
+ TestApp::Controller::Action::Inheritance->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/action/inheritance'),
+ 'Request' );
+ 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::Inheritance',
+ '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'
+ );
+ }
+
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Inheritance::A->begin
+ TestApp::Controller::Action::Inheritance->auto
+ TestApp::Controller::Action::Inheritance::A->auto
+ TestApp::Controller::Action::Inheritance::A->default
+ TestApp::View::Dump::Request->process
+ TestApp::Controller::Action::Inheritance::A->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/action/inheritance/a'),
+ 'Request' );
+ 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::Inheritance::A',
+ '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'
+ );
+ }
+
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Inheritance::A::B->begin
+ TestApp::Controller::Action::Inheritance->auto
+ TestApp::Controller::Action::Inheritance::A->auto
+ TestApp::Controller::Action::Inheritance::A::B->auto
+ TestApp::Controller::Action::Inheritance::A::B->default
+ TestApp::View::Dump::Request->process
+ TestApp::Controller::Action::Inheritance::A::B->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/action/inheritance/a/b'),
+ 'Request' );
+ 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::Inheritance::A::B',
+ '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'
+ );
+ }
+}
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_component_controller_action_inheritance.t
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_component_controller_action_local.t
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_component_controller_action_local.t (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_component_controller_action_local.t 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,138 @@
+#!perl
+
+use strict;
+use warnings;
+
+use FindBin;
+use lib "$FindBin::Bin/../lib";
+
+our $iters;
+
+BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; }
+
+use Test::More tests => 32*$iters;
+use Catalyst::Test 'TestApp';
+
+if ( $ENV{CAT_BENCHMARK} ) {
+ require Benchmark;
+ Benchmark::timethis( $iters, \&run_tests );
+}
+else {
+ for ( 1 .. $iters ) {
+ run_tests();
+ }
+}
+
+sub run_tests {
+ {
+ ok( my $response = request('http://localhost/action/local/one'),
+ 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ is( $response->header('X-Catalyst-Action'),
+ 'action/local/one', 'Test Action' );
+ is(
+ $response->header('X-Test-Class'),
+ 'TestApp::Controller::Action::Local',
+ 'Test Class'
+ );
+ like(
+ $response->content,
+ qr/^bless\( .* 'Catalyst::Request' \)$/s,
+ 'Content is a serialized Catalyst::Request'
+ );
+ }
+
+ {
+ ok( my $response = request('http://localhost/action/local/two/1/2'),
+ 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ is( $response->header('X-Catalyst-Action'),
+ 'action/local/two', 'Test Action' );
+ is(
+ $response->header('X-Test-Class'),
+ 'TestApp::Controller::Action::Local',
+ 'Test Class'
+ );
+ like(
+ $response->content,
+ qr/^bless\( .* 'Catalyst::Request' \)$/s,
+ 'Content is a serialized Catalyst::Request'
+ );
+ }
+
+ {
+ ok( my $response = request('http://localhost/action/local/two'),
+ 'Request' );
+ ok( !$response->is_success, 'Request with wrong number of args failed' );
+ }
+
+ {
+ ok( my $response = request('http://localhost/action/local/three'),
+ 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ is( $response->header('X-Catalyst-Action'),
+ 'action/local/three', 'Test Action' );
+ is(
+ $response->header('X-Test-Class'),
+ 'TestApp::Controller::Action::Local',
+ 'Test Class'
+ );
+ like(
+ $response->content,
+ qr/^bless\( .* 'Catalyst::Request' \)$/s,
+ 'Content is a serialized Catalyst::Request'
+ );
+ }
+
+ {
+ ok(
+ my $response =
+ request('http://localhost/action/local/four/five/six'),
+ 'Request'
+ );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ is( $response->header('X-Catalyst-Action'),
+ 'action/local/four/five/six', 'Test Action' );
+ is(
+ $response->header('X-Test-Class'),
+ 'TestApp::Controller::Action::Local',
+ 'Test Class'
+ );
+ like(
+ $response->content,
+ qr/^bless\( .* 'Catalyst::Request' \)$/s,
+ 'Content is a serialized Catalyst::Request'
+ );
+ }
+
+ SKIP:
+ {
+ if ( $ENV{CATALYST_SERVER} ) {
+ skip "tests for %2F on remote server", 6;
+ }
+
+ ok(
+ my $response =
+ request('http://localhost/action/local/one/foo%2Fbar'),
+ 'Request'
+ );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ is( $response->header('X-Catalyst-Action'),
+ 'action/local/one', 'Test Action' );
+ is(
+ $response->header('X-Test-Class'),
+ 'TestApp::Controller::Action::Local',
+ 'Test Class'
+ );
+ like(
+ $response->content,
+ qr~arguments => \[\s*'foo/bar'\s*\]~,
+ "Parameters don't split on %2F"
+ );
+ }
+}
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_component_controller_action_local.t
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_component_controller_action_multipath.t
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_component_controller_action_multipath.t (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_component_controller_action_multipath.t 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,73 @@
+#!perl
+
+use strict;
+use warnings;
+
+use FindBin;
+use lib "$FindBin::Bin/../lib";
+
+my $content = q/foo
+bar
+baz
+/;
+
+our $iters;
+
+BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; }
+
+use Test::More tests => 16*$iters;
+use Catalyst::Test 'TestApp';
+
+if ( $ENV{CAT_BENCHMARK} ) {
+ require Benchmark;
+ Benchmark::timethis( $iters, \&run_tests );
+}
+else {
+ for ( 1 .. $iters ) {
+ run_tests($content);
+ }
+}
+
+sub run_tests {
+ my ($content) = @_;
+
+ # Local
+ {
+ ok(
+ my $response =
+ request('http://localhost/action/multipath/multipath'),
+ 'Request'
+ );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ is( $response->content, $content, 'Content is a stream' );
+ }
+
+ # Global
+ {
+ ok( my $response = request('http://localhost/multipath'), 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ is( $response->content, $content, 'Content is a stream' );
+ }
+
+ # Path('/multipath1')
+ {
+ ok( my $response = request('http://localhost/multipath1'), 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ is( $response->content, $content, 'Content is a stream' );
+ }
+
+ # Path('multipath2')
+ {
+ ok(
+ my $response =
+ request('http://localhost/action/multipath/multipath2'),
+ 'Request'
+ );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ is( $response->content, $content, 'Content is a stream' );
+ }
+}
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_component_controller_action_multipath.t
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_component_controller_action_path.t
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_component_controller_action_path.t (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_component_controller_action_path.t 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,145 @@
+#!perl
+
+use strict;
+use warnings;
+
+use FindBin;
+use lib "$FindBin::Bin/../lib";
+
+our $iters;
+
+BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; }
+
+use Test::More tests => 36*$iters;
+use Catalyst::Test 'TestApp';
+
+if ( $ENV{CAT_BENCHMARK} ) {
+ require Benchmark;
+ Benchmark::timethis( $iters, \&run_tests );
+}
+else {
+ for ( 1 .. $iters ) {
+ run_tests();
+ }
+}
+
+sub run_tests {
+ {
+ ok(
+ my $response =
+ request('http://localhost/action/path/a%20path%20with%20spaces'),
+ 'Request'
+ );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ is(
+ $response->header('X-Catalyst-Action'),
+ 'action/path/a%20path%20with%20spaces',
+ 'Test Action'
+ );
+ is(
+ $response->header('X-Test-Class'),
+ 'TestApp::Controller::Action::Path',
+ 'Test Class'
+ );
+ like(
+ $response->content,
+ qr/^bless\( .* 'Catalyst::Request' \)$/s,
+ 'Content is a serialized Catalyst::Request'
+ );
+ }
+
+ {
+ ok( my $response = request('http://localhost/action/path/åäö'),
+ 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ is( $response->header('X-Catalyst-Action'),
+ 'action/path/%C3%A5%C3%A4%C3%B6', 'Test Action' );
+ is(
+ $response->header('X-Test-Class'),
+ 'TestApp::Controller::Action::Path',
+ 'Test Class'
+ );
+ like(
+ $response->content,
+ qr/^bless\( .* 'Catalyst::Request' \)$/s,
+ 'Content is a serialized Catalyst::Request'
+ );
+ }
+
+ {
+ ok( my $response = request('http://localhost/action/path/'),
+ 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ is( $response->header('X-Catalyst-Action'),
+ 'action/path', 'Test Action' );
+ is(
+ $response->header('X-Test-Class'),
+ 'TestApp::Controller::Action::Path',
+ 'Test Class'
+ );
+ like(
+ $response->content,
+ qr/^bless\( .* 'Catalyst::Request' \)$/s,
+ 'Content is a serialized Catalyst::Request'
+ );
+ }
+
+ {
+ ok( my $response = request('http://localhost/action/path/spaces_near_parens_singleq'),
+ 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ is( $response->header('X-Catalyst-Action'),
+ 'action/path/spaces_near_parens_singleq', 'Test Action' );
+ is(
+ $response->header('X-Test-Class'),
+ 'TestApp::Controller::Action::Path',
+ 'Test Class'
+ );
+ like(
+ $response->content,
+ qr/^bless\( .* 'Catalyst::Request' \)$/s,
+ 'Content is a serialized Catalyst::Request'
+ );
+ }
+
+ {
+ ok( my $response = request('http://localhost/action/path/spaces_near_parens_doubleq'),
+ 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ is( $response->header('X-Catalyst-Action'),
+ 'action/path/spaces_near_parens_doubleq', 'Test Action' );
+ is(
+ $response->header('X-Test-Class'),
+ 'TestApp::Controller::Action::Path',
+ 'Test Class'
+ );
+ like(
+ $response->content,
+ qr/^bless\( .* 'Catalyst::Request' \)$/s,
+ 'Content is a serialized Catalyst::Request'
+ );
+ }
+
+ {
+ ok( my $response = request('http://localhost/0'), 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ is( $response->header('X-Catalyst-Action'),
+ '0', 'Test Action' );
+ is(
+ $response->header('X-Test-Class'),
+ 'TestApp::Controller::Root',
+ 'Test Class'
+ );
+ like(
+ $response->content,
+ qr/^bless\( .* 'Catalyst::Request' \)$/s,
+ 'Content is a serialized Catalyst::Request'
+ );
+ }
+}
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_component_controller_action_path.t
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_component_controller_action_private.t
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_component_controller_action_private.t (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_component_controller_action_private.t 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,89 @@
+#!perl
+
+use strict;
+use warnings;
+
+use FindBin;
+use lib "$FindBin::Bin/../lib";
+
+our $iters;
+
+BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; }
+
+use Test::More tests => 24*$iters;
+use Catalyst::Test 'TestApp';
+
+if ( $ENV{CAT_BENCHMARK} ) {
+ require Benchmark;
+ Benchmark::timethis( $iters, \&run_tests );
+}
+else {
+ for ( 1 .. $iters ) {
+ run_tests();
+ }
+}
+
+sub run_tests {
+ {
+ ok( my $response = request('http://localhost/action/private/one'),
+ 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ is(
+ $response->header('X-Test-Class'),
+ 'TestApp::Controller::Action::Private',
+ 'Test Class'
+ );
+ is( $response->content, 'access denied', 'Access' );
+ }
+
+ {
+ ok( my $response = request('http://localhost/action/private/two'),
+ 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ is(
+ $response->header('X-Test-Class'),
+ 'TestApp::Controller::Action::Private',
+ 'Test Class'
+ );
+ is( $response->content, 'access denied', 'Access' );
+ }
+
+ {
+ ok( my $response = request('http://localhost/three'), 'Request' );
+ ok( $response->is_error, 'Response Server Error 5xx' );
+ is( $response->content_type, 'text/html', 'Response Content-Type' );
+ like(
+ $response->header('X-Catalyst-Error'),
+ qr/^Unknown resource "three"/,
+ 'Catalyst Error'
+ );
+ }
+
+ {
+ ok( my $response = request('http://localhost/action/private/four'),
+ 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ is(
+ $response->header('X-Test-Class'),
+ 'TestApp::Controller::Action::Private',
+ 'Test Class'
+ );
+ is( $response->content, 'access denied', 'Access' );
+ }
+
+ {
+ ok( my $response = request('http://localhost/action/private/five'),
+ 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ is(
+ $response->header('X-Test-Class'),
+ 'TestApp::Controller::Action::Private',
+ 'Test Class'
+ );
+ is( $response->content, 'access denied', 'Access' );
+ }
+}
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_component_controller_action_private.t
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_component_controller_action_regexp.t
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_component_controller_action_regexp.t (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_component_controller_action_regexp.t 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,121 @@
+#!perl
+
+use strict;
+use warnings;
+
+use FindBin;
+use lib "$FindBin::Bin/../lib";
+
+our $iters;
+
+BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; }
+
+use Test::More tests => 33*$iters;
+use Catalyst::Test 'TestApp';
+
+use Catalyst::Request;
+
+if ( $ENV{CAT_BENCHMARK} ) {
+ require Benchmark;
+ Benchmark::timethis( $iters, \&run_tests );
+}
+else {
+ for ( 1 .. $iters ) {
+ run_tests();
+ }
+}
+
+sub run_tests {
+ {
+ ok( my $response = request('http://localhost/action/regexp/10/hello'),
+ 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ is( $response->header('X-Catalyst-Action'),
+ '^action/regexp/(\d+)/(\w+)$', 'Test Action' );
+ is(
+ $response->header('X-Test-Class'),
+ 'TestApp::Controller::Action::Regexp',
+ 'Test Class'
+ );
+ like(
+ $response->content,
+ qr/^bless\( .* 'Catalyst::Request' \)$/s,
+ 'Content is a serialized Catalyst::Request'
+ );
+ }
+
+ {
+ ok( my $response = request('http://localhost/action/regexp/hello/10'),
+ 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ is( $response->header('X-Catalyst-Action'),
+ '^action/regexp/(\w+)/(\d+)$', 'Test Action' );
+ is(
+ $response->header('X-Test-Class'),
+ 'TestApp::Controller::Action::Regexp',
+ 'Test Class'
+ );
+ like(
+ $response->content,
+ qr/^bless\( .* 'Catalyst::Request' \)$/s,
+ 'Content is a serialized Catalyst::Request'
+ );
+ }
+
+ {
+ ok( my $response = request('http://localhost/action/regexp/mandatory'),
+ 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ is( $response->header('X-Catalyst-Action'),
+ '^action/regexp/(mandatory)(/optional)?$', 'Test Action' );
+ is(
+ $response->header('X-Test-Class'),
+ 'TestApp::Controller::Action::Regexp',
+ 'Test Class'
+ );
+ my $content = $response->content;
+ my $req = eval $content;
+
+ is( scalar @{ $req->captures }, 2, 'number of captures' );
+ is( $req->captures->[ 0 ], 'mandatory', 'mandatory capture' );
+ ok( !defined $req->captures->[ 1 ], 'optional capture' );
+ }
+
+ {
+ ok( my $response = request('http://localhost/action/regexp/mandatory/optional'),
+ 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ is( $response->header('X-Catalyst-Action'),
+ '^action/regexp/(mandatory)(/optional)?$', 'Test Action' );
+ is(
+ $response->header('X-Test-Class'),
+ 'TestApp::Controller::Action::Regexp',
+ 'Test Class'
+ );
+ my $content = $response->content;
+ my $req = eval $content;
+
+ is( scalar @{ $req->captures }, 2, 'number of captures' );
+ is( $req->captures->[ 0 ], 'mandatory', 'mandatory capture' );
+ is( $req->captures->[ 1 ], '/optional', 'optional capture' );
+ }
+
+ # test localregex in the root controller
+ {
+ ok( my $response = request('http://localhost/localregex'),
+ 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ is( $response->header('X-Catalyst-Action'),
+ '^localregex$', 'Test Action' );
+ is(
+ $response->header('X-Test-Class'),
+ 'TestApp::Controller::Root',
+ 'Test Class'
+ );
+ }
+}
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_component_controller_action_regexp.t
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_component_controller_action_streaming.t
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_component_controller_action_streaming.t (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_component_controller_action_streaming.t 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,72 @@
+#!perl
+
+use strict;
+use warnings;
+
+use FindBin;
+use lib "$FindBin::Bin/../lib";
+
+our $iters;
+
+BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; }
+
+use Test::More tests => 10*$iters;
+use Catalyst::Test 'TestApp';
+
+if ( $ENV{CAT_BENCHMARK} ) {
+ require Benchmark;
+ Benchmark::timethis( $iters, \&run_tests );
+}
+else {
+ for ( 1 .. $iters ) {
+ run_tests();
+ }
+}
+
+sub run_tests {
+ # test direct streaming
+ {
+ ok( my $response = request('http://localhost/streaming'), 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+
+ SKIP:
+ {
+ if ( $ENV{CATALYST_SERVER} ) {
+ skip "Using remote server", 1;
+ }
+
+ # XXX: Length should be undef here, but HTTP::Request::AsCGI sets it
+ is( $response->content_length, 12, 'Response Content-Length' );
+ }
+
+ is( $response->content,, <<'EOF', 'Content is a stream' );
+foo
+bar
+baz
+EOF
+ }
+
+ # test streaming by passing a handle to $c->res->body
+ SKIP:
+ {
+ if ( $ENV{CATALYST_SERVER} ) {
+ skip "Using remote server", 5;
+ }
+
+ my $file = "$FindBin::Bin/../01use.t";
+ my $fh = IO::File->new( $file, 'r' );
+ my $buffer;
+ if ( defined $fh ) {
+ $fh->read( $buffer, 1024 );
+ $fh->close;
+ }
+
+ ok( my $response = request('http://localhost/action/streaming/body'),
+ 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ is( $response->content_length, -s $file, 'Response Content-Length' );
+ is( $response->content, $buffer, 'Content is read from filehandle' );
+ }
+}
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_component_controller_action_streaming.t
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_component_controller_action_visit.t
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_component_controller_action_visit.t (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_component_controller_action_visit.t 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,289 @@
+#!perl
+
+use strict;
+use warnings;
+
+use FindBin;
+use lib "$FindBin::Bin/../lib";
+
+our $iters;
+
+BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; }
+
+use Test::More tests => 54 * $iters;
+use Catalyst::Test 'TestApp';
+
+if ( $ENV{CAT_BENCHMARK} ) {
+ require Benchmark;
+ Benchmark::timethis( $iters, \&run_tests );
+}
+else {
+ for ( 1 .. $iters ) {
+ run_tests();
+ }
+}
+
+sub run_tests {
+ {
+ # Test visit to global private action
+ ok( my $response = request('http://localhost/action/visit/global'),
+ 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ is( $response->header('X-Catalyst-Action'),
+ 'action/visit/global', 'Main Class Action' );
+ }
+
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Visit->one
+ TestApp::Controller::Action::Visit->two
+ TestApp::Controller::Action::Visit->three
+ 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
+ ];
+
+ @expected = map { /Action/ ? (_begin($_), $_) : ($_) } @expected;
+ my $expected = join( ", ", @expected );
+
+ # Test visit to chain of actions.
+ ok( my $response = request('http://localhost/action/visit/one'),
+ 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ is( $response->header('X-Catalyst-Action'),
+ 'action/visit/one', 'Test Action' );
+ is(
+ $response->header('X-Test-Class'),
+ 'TestApp::Controller::Action::Visit',
+ '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'
+ );
+ }
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Visit->visit_die
+ TestApp::Controller::Action::Visit->args
+ TestApp->end
+ TestApp->end
+ ];
+
+ @expected = map { /Action/ ? (_begin($_), $_) : ($_) } @expected;
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/action/visit/visit_die'),
+ 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ is( $response->header('X-Catalyst-Action'),
+ 'action/visit/visit_die', 'Test Action'
+ );
+ is(
+ $response->header('X-Test-Class'),
+ 'TestApp::Controller::Action::Visit',
+ 'Test Class'
+ );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->content, "visit() doesn't die", "Visit does not die" );
+ }
+ {
+ ok(
+ my $response = request('http://localhost/action/visit/model'),
+ 'Request with args'
+ );
+ is( $response->content,
+ q[FATAL ERROR: Couldn't visit("Model::Foo"): Action cannot _DISPATCH. Did you try to visit() a non-controller action?]
+ );
+ }
+ {
+ ok(
+ my $response = request('http://localhost/action/visit/view'),
+ 'Request with args'
+ );
+ is( $response->content,
+ q[FATAL ERROR: Couldn't visit("View::Dump"): Action cannot _DISPATCH. Did you try to visit() a non-controller action?]
+ );
+ }
+ {
+ ok(
+ my $response =
+ request('http://localhost/action/visit/with_args/old'),
+ 'Request with args'
+ );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content, 'old', 'visit() with args (old)' );
+ }
+
+ {
+ ok(
+ my $response = request(
+ 'http://localhost/action/visit/with_method_and_args/new'),
+ 'Request with args and method'
+ );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content, 'new', 'visit() with args (new)' );
+ }
+
+ # test visit with embedded args
+ {
+ ok(
+ my $response =
+ request('http://localhost/action/visit/args_embed_relative'),
+ 'Request'
+ );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content, 'ok', 'visit() with args_embed_relative' );
+ }
+
+ {
+ ok(
+ my $response =
+ request('http://localhost/action/visit/args_embed_absolute'),
+ 'Request'
+ );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content, 'ok', 'visit() with args_embed_absolute' );
+ }
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::TestRelative->relative_visit
+ TestApp::Controller::Action::Visit->one
+ TestApp::Controller::Action::Visit->two
+ TestApp::Controller::Action::Visit->three
+ 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
+ ];
+
+ @expected = map { /Action/ ? (_begin($_), $_) : ($_) } @expected;
+ my $expected = join( ", ", @expected );
+
+ # Test visit to chain of actions.
+ ok( my $response = request('http://localhost/action/relative/relative_visit'),
+ 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ is( $response->header('X-Catalyst-Action'),
+ 'action/relative/relative_visit', 'Test Action' );
+ is(
+ $response->header('X-Test-Class'),
+ 'TestApp::Controller::Action::Visit',
+ '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'
+ );
+ }
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::TestRelative->relative_visit_two
+ TestApp::Controller::Action::Visit->one
+ TestApp::Controller::Action::Visit->two
+ TestApp::Controller::Action::Visit->three
+ 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
+ ];
+
+ @expected = map { /Action/ ? (_begin($_), $_) : ($_) } @expected;
+ my $expected = join( ", ", @expected );
+
+ # Test visit to chain of actions.
+ ok(
+ my $response =
+ request('http://localhost/action/relative/relative_visit_two'),
+ 'Request'
+ );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ is(
+ $response->header('X-Catalyst-Action'),
+ 'action/relative/relative_visit_two',
+ 'Test Action'
+ );
+ is(
+ $response->header('X-Test-Class'),
+ 'TestApp::Controller::Action::Visit',
+ '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'
+ );
+ }
+
+ # test class visit -- MUST FAIL!
+ {
+ ok(
+ my $response = request(
+ 'http://localhost/action/visit/class_visit_test_action'),
+ 'Request'
+ );
+ ok( !$response->is_success, 'Response Fails' );
+ is( $response->content,
+ q[FATAL ERROR: Couldn't visit("TestApp"): Action has no namespace: cannot visit() to a plain method or component, must be a :Action or some sort.],
+ "Cannot visit app namespace"
+ );
+ }
+
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Visit->begin
+ TestApp::Controller::Action::Visit->visit_chained
+ TestApp::Controller::Action::Chained->begin
+ TestApp::Controller::Action::Chained->foo
+ TestApp::Controller::Action::Chained::Foo->spoon
+ TestApp::Controller::Action::Chained->end
+ TestApp->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/action/visit/visit_chained'), 'visit to chained + subcontroller endpoint' );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->content, '; 1', 'Content OK' );
+ }
+
+}
+
+
+
+sub _begin {
+ local $_ = shift;
+ s/->(.*)$/->begin/;
+ return $_;
+}
+
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_component_controller_action_visit.t
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_component_controller_args.t
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_component_controller_args.t (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_component_controller_args.t 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,98 @@
+#!perl
+
+use strict;
+use warnings;
+
+use FindBin;
+use lib "$FindBin::Bin/../lib";
+
+use URI::Escape;
+
+our @paths;
+our $iters;
+
+BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1;
+
+ # add special paths to test here
+ @paths = (
+ # all reserved in uri's
+ qw~ : / ? [ ] @ ! $ & ' ( ) * + ; = ~, ',' , '#',
+
+ # unreserved
+ 'a'..'z','A'..'Z',0..9,qw( - . _ ~ ),
+ " ",
+
+ # just to test %2F/%
+ [ qw~ / / ~ ],
+
+ # testing %25/%25
+ [ qw~ % % ~ ],
+ );
+}
+
+use Test::More tests => 6*@paths * $iters;
+use Catalyst::Test 'TestApp';
+
+if ( $ENV{CAT_BENCHMARK} ) {
+ require Benchmark;
+ Benchmark::timethis( $iters, \&run_tests );
+
+ # new dispatcher:
+ # 11 wallclock secs (10.14 usr + 0.20 sys = 10.34 CPU) @ 15.18/s (n=157)
+ # old dispatcher (r1486):
+ # 11 wallclock secs (10.34 usr + 0.20 sys = 10.54 CPU) @ 13.76/s (n=145)
+}
+else {
+ for ( 1 .. $iters ) {
+ run_tests();
+ }
+}
+
+sub run_tests {
+ run_test_for($_) for @paths;
+}
+
+sub run_test_for {
+ my $test = shift;
+
+ my $path;
+ if (ref $test) {
+ $path = join "/", map uri_escape($_), @$test;
+ $test = join '', @$test;
+ } else {
+ $path = uri_escape($test);
+ }
+
+ SKIP:
+ {
+ # Skip %2F, ., [, (, and ) tests on real webservers
+ # Both Apache and lighttpd don't seem to like these
+ if ( $ENV{CATALYST_SERVER} && $path =~ /(?:%2F|\.|%5B|\(|\))/ ) {
+ skip "Skipping $path tests on remote server", 6;
+ }
+
+ my $response;
+
+ ok( $response = request("http://localhost/args/args/$path"), "Requested args for path $path");
+
+ is( $response->content, $test, "$test as args" );
+
+ undef $response;
+
+ ok( $response = request("http://localhost/args/params/$path"), "Requested params for path $path");
+
+ is( $response->content, $test, "$test as params" );
+
+ undef $response;
+
+ if( $test =~ m{/} ) {
+ $test =~ s{/}{}g;
+ $path = uri_escape( $test );
+ }
+
+ ok( $response = request("http://localhost/chained/multi_cap/$path/baz"), "Requested capture for path $path");
+
+ is( $response->content, join( ', ', split( //, $test ) ) ."; ", "$test as capture" );
+ }
+}
+
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_component_controller_args.t
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_engine_request_auth.t
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_engine_request_auth.t (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_engine_request_auth.t 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,43 @@
+#!perl
+
+# This tests to make sure the Authorization header is passed through by the engine.
+
+use strict;
+use warnings;
+
+use FindBin;
+use lib "$FindBin::Bin/../lib";
+
+use Test::More tests => 7;
+use Catalyst::Test 'TestApp';
+
+use Catalyst::Request;
+use HTTP::Headers;
+use HTTP::Request::Common;
+
+{
+ my $creq;
+
+ my $request = GET(
+ 'http://localhost/dump/request',
+ 'Authorization' => 'Basic dGVzdDoxMjM0NQ==',
+ );
+
+ ok( my $response = request($request), 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ like( $response->content, qr/'Catalyst::Request'/,
+ 'Content is a serialized Catalyst::Request' );
+
+ {
+ no strict 'refs';
+ ok(
+ eval '$creq = ' . $response->content,
+ 'Unserialize Catalyst::Request'
+ );
+ }
+
+ isa_ok( $creq, 'Catalyst::Request' );
+
+ is( $creq->header('Authorization'), 'Basic dGVzdDoxMjM0NQ==', 'auth header ok' );
+}
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_engine_request_auth.t
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_engine_request_body.t
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_engine_request_body.t (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_engine_request_body.t 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,77 @@
+#!perl
+
+use strict;
+use warnings;
+
+use FindBin;
+use lib "$FindBin::Bin/../lib";
+
+use Test::More tests => 18;
+use Catalyst::Test 'TestApp';
+
+use Catalyst::Request;
+use HTTP::Headers;
+use HTTP::Request::Common;
+
+{
+ my $creq;
+
+ my $request = POST(
+ 'http://localhost/dump/request/',
+ 'Content-Type' => 'text/plain',
+ 'Content' => 'Hello Catalyst'
+ );
+
+ ok( my $response = request($request), 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ like( $response->content, qr/'Catalyst::Request'/,
+ 'Content is a serialized Catalyst::Request' );
+
+ {
+ no strict 'refs';
+ ok(
+ eval '$creq = ' . $response->content,
+ 'Unserialize Catalyst::Request'
+ );
+ }
+
+ isa_ok( $creq, 'Catalyst::Request' );
+ is( $creq->method, 'POST', 'Catalyst::Request method' );
+ is( $creq->content_type, 'text/plain', 'Catalyst::Request Content-Type' );
+ is( $creq->content_length, $request->content_length,
+ 'Catalyst::Request Content-Length' );
+}
+
+{
+ my $creq;
+
+ my $request = POST(
+ 'http://localhost/dump/request/',
+ 'Content-Type' => 'text/plain',
+ 'Content' => 'x' x 100_000
+ );
+
+ ok( my $response = request($request), 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ like(
+ $response->content,
+ qr/^bless\( .* 'Catalyst::Request' \)$/s,
+ 'Content is a serialized Catalyst::Request'
+ );
+
+ {
+ no strict 'refs';
+ ok(
+ eval '$creq = ' . $response->content,
+ 'Unserialize Catalyst::Request'
+ );
+ }
+
+ isa_ok( $creq, 'Catalyst::Request' );
+ is( $creq->method, 'POST', 'Catalyst::Request method' );
+ is( $creq->content_type, 'text/plain', 'Catalyst::Request Content-Type' );
+ is( $creq->content_length, $request->content_length,
+ 'Catalyst::Request Content-Length' );
+}
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_engine_request_body.t
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_engine_request_body_demand.t
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_engine_request_body_demand.t (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_engine_request_body_demand.t 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,66 @@
+#!perl
+
+use strict;
+use warnings;
+
+use FindBin;
+use lib "$FindBin::Bin/../lib";
+
+use Test::More tests => 8;
+use Catalyst::Test 'TestAppOnDemand';
+
+use Catalyst::Request;
+use HTTP::Headers;
+use HTTP::Request::Common;
+
+# Test a simple POST request to make sure body parsing
+# works in on-demand mode.
+SKIP:
+{
+ if ( $ENV{CATALYST_SERVER} ) {
+ skip "Using remote server", 8;
+ }
+
+ {
+ my $params;
+
+ my $request = POST(
+ 'http://localhost/body/params',
+ 'Content-Type' => 'application/x-www-form-urlencoded',
+ 'Content' => 'foo=bar&baz=quux'
+ );
+
+ my $expected = { foo => 'bar', baz => 'quux' };
+
+ ok( my $response = request($request), 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+
+ {
+ no strict 'refs';
+ ok(
+ eval '$params = ' . $response->content,
+ 'Unserialize params'
+ );
+ }
+
+ is_deeply( $params, $expected, 'Catalyst::Request body parameters' );
+ }
+
+ # Test reading chunks of the request body using $c->read
+ {
+ my $creq;
+
+ my $request = POST(
+ 'http://localhost/body/read',
+ 'Content-Type' => 'text/plain',
+ 'Content' => 'x' x 105_000
+ );
+
+ my $expected = '10000|10000|10000|10000|10000|10000|10000|10000|10000|10000|5000';
+
+ ok( my $response = request($request), 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ is( $response->content, $expected, 'Response Content' );
+ }
+}
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_engine_request_body_demand.t
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_engine_request_cookies.t
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_engine_request_cookies.t (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_engine_request_cookies.t 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,45 @@
+#!perl
+
+use strict;
+use warnings;
+
+use FindBin;
+use lib "$FindBin::Bin/../lib";
+
+use Test::More tests => 13;
+use Catalyst::Test 'TestApp';
+
+use Catalyst::Request;
+use CGI::Simple::Cookie;
+use HTTP::Headers;
+use HTTP::Request::Common;
+use URI;
+
+{
+ my $creq;
+
+ my $request = GET( 'http://localhost/dump/request',
+ 'Cookie' => 'Catalyst=Cool; Cool=Catalyst', );
+
+ ok( my $response = request($request), 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ like( $response->content, qr/'Catalyst::Request'/,
+ 'Content is a serialized Catalyst::Request' );
+ ok( eval '$creq = ' . $response->content, 'Unserialize Catalyst::Request' );
+ isa_ok( $creq, 'Catalyst::Request' );
+ isa_ok( $creq->cookies->{Catalyst}, 'CGI::Simple::Cookie',
+ 'Cookie Catalyst' );
+ is( $creq->cookies->{Catalyst}->name, 'Catalyst', 'Cookie Catalyst name' );
+ is( $creq->cookies->{Catalyst}->value, 'Cool', 'Cookie Catalyst value' );
+ isa_ok( $creq->cookies->{Cool}, 'CGI::Simple::Cookie', 'Cookie Cool' );
+ is( $creq->cookies->{Cool}->name, 'Cool', 'Cookie Cool name' );
+ is( $creq->cookies->{Cool}->value, 'Catalyst', 'Cookie Cool value' );
+
+ my $cookies = {
+ Catalyst => $creq->cookies->{Catalyst},
+ Cool => $creq->cookies->{Cool}
+ };
+
+ is_deeply( $creq->cookies, $cookies, 'Cookies' );
+}
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_engine_request_cookies.t
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_engine_request_headers.t
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_engine_request_headers.t (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_engine_request_headers.t 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,71 @@
+#!perl
+
+use strict;
+use warnings;
+
+use FindBin;
+use lib "$FindBin::Bin/../lib";
+
+use Test::More tests => 17;
+use Catalyst::Test 'TestApp';
+
+use Catalyst::Request;
+use HTTP::Headers;
+use HTTP::Request::Common;
+
+{
+ my $creq;
+
+ my $request = GET( 'http://localhost/dump/request',
+ 'User-Agent' => 'MyAgen/1.0',
+ 'X-Whats-Cool' => 'Catalyst',
+ 'X-Multiple' => [ 1 .. 5 ],
+ 'X-Forwarded-Host' => 'frontend.server.com',
+ 'X-Forwarded-For' => '192.168.1.1, 1.2.3.4',
+ );
+
+ ok( my $response = request($request), 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ like( $response->content, qr/^bless\( .* 'Catalyst::Request' \)$/s, 'Content is a serialized Catalyst::Request' );
+ ok( eval '$creq = ' . $response->content, 'Unserialize Catalyst::Request' );
+ isa_ok( $creq, 'Catalyst::Request' );
+ isa_ok( $creq->headers, 'HTTP::Headers', 'Catalyst::Request->headers' );
+ is( $creq->header('X-Whats-Cool'), $request->header('X-Whats-Cool'), 'Catalyst::Request->header X-Whats-Cool' );
+
+ { # Test that multiple headers are joined as per RFC 2616 4.2 and RFC 3875 4.1.18
+
+ my $excpected = '1, 2, 3, 4, 5';
+ my $got = $creq->header('X-Multiple'); # HTTP::Headers is context sensitive, "force" scalar context
+
+ is( $got, $excpected, 'Multiple message-headers are joined as a comma-separated list' );
+ }
+
+ is( $creq->header('User-Agent'), $request->header('User-Agent'), 'Catalyst::Request->header User-Agent' );
+
+ my $host = sprintf( '%s:%d', $request->uri->host, $request->uri->port );
+ is( $creq->header('Host'), $host, 'Catalyst::Request->header Host' );
+
+ SKIP:
+ {
+ if ( $ENV{CATALYST_SERVER} && $ENV{CATALYST_SERVER} !~ /127.0.0.1|localhost/ ) {
+ skip "Using remote server", 2;
+ }
+
+ is( $creq->base->host, 'frontend.server.com', 'Catalyst::Request proxied base' );
+ is( $creq->address, '1.2.3.4', 'Catalyst::Request proxied address' );
+ }
+
+ SKIP:
+ {
+ if ( $ENV{CATALYST_SERVER} ) {
+ skip "Using remote server", 4;
+ }
+ # test that we can ignore the proxy support
+ TestApp->config->{ignore_frontend_proxy} = 1;
+ ok( $response = request($request), 'Request' );
+ ok( eval '$creq = ' . $response->content, 'Unserialize Catalyst::Request' );
+ is( $creq->base, 'http://localhost/', 'Catalyst::Request non-proxied base' );
+ is( $creq->address, '127.0.0.1', 'Catalyst::Request non-proxied address' );
+ }
+}
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_engine_request_headers.t
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_engine_request_parameters.t
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_engine_request_parameters.t (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_engine_request_parameters.t 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,162 @@
+#!perl
+
+use strict;
+use warnings;
+
+use FindBin;
+use lib "$FindBin::Bin/../lib";
+
+use Test::More tests => 53;
+use Catalyst::Test 'TestApp';
+
+use Catalyst::Request;
+use HTTP::Headers;
+use HTTP::Request::Common;
+
+{
+ my $creq;
+
+ my $parameters = { 'a' => [qw(A b C d E f G)], };
+
+ my $query = join( '&', map { 'a=' . $_ } @{ $parameters->{a} } );
+
+ ok( my $response = request("http://localhost/dump/request?$query"),
+ 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ like(
+ $response->content,
+ qr/^bless\( .* 'Catalyst::Request' \)$/s,
+ 'Content is a serialized Catalyst::Request'
+ );
+ ok( eval '$creq = ' . $response->content, 'Unserialize Catalyst::Request' );
+ isa_ok( $creq, 'Catalyst::Request' );
+ is( $creq->method, 'GET', 'Catalyst::Request method' );
+ is_deeply( $creq->parameters, $parameters,
+ 'Catalyst::Request parameters' );
+}
+
+{
+ my $creq;
+ ok( my $response = request("http://localhost/dump/request?q=foo%2bbar"),
+ 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ ok( eval '$creq = ' . $response->content );
+ is $creq->parameters->{q}, 'foo+bar', '%2b not double decoded';
+}
+
+{
+ my $creq;
+ ok( my $response = request("http://localhost/dump/request?q=foo=bar"),
+ 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ ok( eval '$creq = ' . $response->content );
+ is $creq->parameters->{q}, 'foo=bar', '= not ignored';
+}
+
+{
+ my $creq;
+
+ my $parameters = {
+ 'a' => [qw(A b C d E f G)],
+ '%' => [ '%', '"', '& - &' ],
+ 'blank' => '',
+ };
+
+ my $request = POST(
+ 'http://localhost/dump/request/a/b?a=1&a=2&a=3',
+ 'Content' => $parameters,
+ 'Content-Type' => 'application/x-www-form-urlencoded'
+ );
+
+ unshift( @{ $parameters->{a} }, 1, 2, 3 );
+
+ ok( my $response = request($request), 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ like(
+ $response->content,
+ qr/^bless\( .* 'Catalyst::Request' \)$/s,
+ 'Content is a serialized Catalyst::Request'
+ );
+ ok( eval '$creq = ' . $response->content, 'Unserialize Catalyst::Request' );
+ isa_ok( $creq, 'Catalyst::Request' );
+ is( $creq->method, 'POST', 'Catalyst::Request method' );
+ is_deeply( $creq->parameters, $parameters,
+ 'Catalyst::Request parameters' );
+ is_deeply( $creq->arguments, [qw(a b)], 'Catalyst::Request arguments' );
+ is_deeply( $creq->uploads, {}, 'Catalyst::Request uploads' );
+ is_deeply( $creq->cookies, {}, 'Catalyst::Request cookie' );
+}
+
+# http://dev.catalyst.perl.org/ticket/37
+# multipart/form-data parameters that contain 'http://'
+# was an HTTP::Message bug, but HTTP::Body handles it properly now
+{
+ my $creq;
+
+ my $parameters = {
+ 'url' => 'http://www.google.com',
+ 'blank' => '',
+ };
+
+ my $request = POST( 'http://localhost/dump/request',
+ 'Content-Type' => 'multipart/form-data',
+ 'Content' => $parameters,
+ );
+
+ ok( my $response = request($request), 'Request' );
+ ok( eval '$creq = ' . $response->content, 'Unserialize Catalyst::Request' );
+ is_deeply( $creq->parameters, $parameters, 'Catalyst::Request parameters' );
+}
+
+# raw query string support
+{
+ my $creq;
+
+ my $parameters = {
+ a => 1,
+ blank => '',
+ };
+
+ my $request = POST(
+ 'http://localhost/dump/request/a/b?query+string',
+ 'Content' => $parameters,
+ 'Content-Type' => 'application/x-www-form-urlencoded'
+ );
+
+ ok( my $response = request($request), 'Request' );
+ ok( eval '$creq = ' . $response->content, 'Unserialize Catalyst::Request' );
+ is( $creq->uri->query, 'query+string', 'Catalyst::Request POST query_string' );
+ is( $creq->query_keywords, 'query string', 'Catalyst::Request query_keywords' );
+ is_deeply( $creq->parameters, $parameters, 'Catalyst::Request parameters' );
+
+ ok( $response = request('http://localhost/dump/request/a/b?x=1&y=1&z=1'), 'Request' );
+ ok( eval '$creq = ' . $response->content, 'Unserialize Catalyst::Request' );
+ is( $creq->uri->query, 'x=1&y=1&z=1', 'Catalyst::Request GET query_string' );
+}
+
+{
+ my $creq;
+ ok( my $response = request("http://localhost/dump/request?&&q="),
+ 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ ok( eval '$creq = ' . $response->content );
+ is( keys %{$creq->{parameters}}, 1, 'remove empty parameter' );
+ is( $creq->{parameters}->{q}, '', 'empty parameter' );
+}
+
+{
+ my $creq;
+ ok( my $response = request("http://localhost/dump/request?&0&q="),
+ 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ ok( eval '$creq = ' . $response->content );
+ is( keys %{$creq->{parameters}}, 2, 'remove empty parameter' );
+ is( $creq->{parameters}->{q}, '', 'empty parameter' );
+ ok( !defined $creq->{parameters}->{0}, 'empty parameter' );
+}
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_engine_request_parameters.t
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_engine_request_uploads.t
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_engine_request_uploads.t (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_engine_request_uploads.t 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,305 @@
+#!perl
+
+use strict;
+use warnings;
+
+use FindBin;
+use lib "$FindBin::Bin/../lib";
+
+use Test::More tests => 88;
+use Catalyst::Test 'TestApp';
+
+use Catalyst::Request;
+use Catalyst::Request::Upload;
+use HTTP::Headers;
+use HTTP::Headers::Util 'split_header_words';
+use HTTP::Request::Common;
+use Path::Class::Dir;
+
+{
+ my $creq;
+
+ my $request = POST(
+ 'http://localhost/dump/request/',
+ 'Content-Type' => 'form-data',
+ 'Content' => [
+ 'live_engine_request_cookies.t' =>
+ ["$FindBin::Bin/live_engine_request_cookies.t"],
+ 'live_engine_request_headers.t' =>
+ ["$FindBin::Bin/live_engine_request_headers.t"],
+ 'live_engine_request_uploads.t' =>
+ ["$FindBin::Bin/live_engine_request_uploads.t"],
+ ]
+ );
+
+ ok( my $response = request($request), 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ like(
+ $response->content,
+ qr/^bless\( .* 'Catalyst::Request' \)$/s,
+ 'Content is a serialized Catalyst::Request'
+ );
+
+ {
+ no strict 'refs';
+ ok(
+ eval '$creq = ' . $response->content,
+ 'Unserialize Catalyst::Request'
+ );
+ }
+
+ isa_ok( $creq, 'Catalyst::Request' );
+ is( $creq->method, 'POST', 'Catalyst::Request method' );
+ is( $creq->content_type, 'multipart/form-data',
+ 'Catalyst::Request Content-Type' );
+ is( $creq->content_length, $request->content_length,
+ 'Catalyst::Request Content-Length' );
+
+ for my $part ( $request->parts ) {
+
+ my $disposition = $part->header('Content-Disposition');
+ my %parameters = @{ ( split_header_words($disposition) )[0] };
+
+ my $upload = $creq->uploads->{ $parameters{filename} };
+
+ isa_ok( $upload, 'Catalyst::Request::Upload' );
+
+ is( $upload->type, $part->content_type, 'Upload Content-Type' );
+ is( $upload->size, length( $part->content ), 'Upload Content-Length' );
+
+ # make sure upload is accessible via legacy params->{$file}
+ is( $creq->parameters->{ $upload->filename },
+ $upload->filename, 'legacy param method ok' );
+
+ ok( !-e $upload->tempname, 'Upload temp file was deleted' );
+ }
+}
+
+{
+ my $creq;
+
+ my $request = POST(
+ 'http://localhost/dump/request/',
+ 'Content-Type' => 'multipart/form-data',
+ 'Content' => [
+ 'testfile' => ["$FindBin::Bin/live_engine_request_cookies.t"],
+ 'testfile' => ["$FindBin::Bin/live_engine_request_headers.t"],
+ 'testfile' => ["$FindBin::Bin/live_engine_request_uploads.t"],
+ ]
+ );
+
+ ok( my $response = request($request), 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ like(
+ $response->content,
+ qr/^bless\( .* 'Catalyst::Request' \)$/s,
+ 'Content is a serialized Catalyst::Request'
+ );
+
+ {
+ no strict 'refs';
+ ok(
+ eval '$creq = ' . $response->content,
+ 'Unserialize Catalyst::Request'
+ );
+ }
+
+ isa_ok( $creq, 'Catalyst::Request' );
+ is( $creq->method, 'POST', 'Catalyst::Request method' );
+ is( $creq->content_type, 'multipart/form-data',
+ 'Catalyst::Request Content-Type' );
+ is( $creq->content_length, $request->content_length,
+ 'Catalyst::Request Content-Length' );
+
+ my @parts = $request->parts;
+
+ for ( my $i = 0 ; $i < @parts ; $i++ ) {
+
+ my $part = $parts[$i];
+ my $disposition = $part->header('Content-Disposition');
+ my %parameters = @{ ( split_header_words($disposition) )[0] };
+
+ my $upload = $creq->uploads->{ $parameters{name} }->[$i];
+
+ isa_ok( $upload, 'Catalyst::Request::Upload' );
+ is( $upload->type, $part->content_type, 'Upload Content-Type' );
+ is( $upload->filename, $parameters{filename}, 'Upload filename' );
+ is( $upload->size, length( $part->content ), 'Upload Content-Length' );
+
+ ok( !-e $upload->tempname, 'Upload temp file was deleted' );
+ }
+}
+
+{
+ my $creq;
+
+ my $request = POST(
+ 'http://localhost/engine/request/uploads/slurp',
+ 'Content-Type' => 'multipart/form-data',
+ 'Content' =>
+ [ 'slurp' => ["$FindBin::Bin/live_engine_request_uploads.t"], ]
+ );
+
+ ok( my $response = request($request), 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ is( $response->content, ( $request->parts )[0]->content, 'Content' );
+}
+
+{
+ my $request = POST(
+ 'http://localhost/dump/request',
+ 'Content-Type' => 'multipart/form-data',
+ 'Content' =>
+ [ 'file' => ["$FindBin::Bin/../catalyst_130pix.gif"], ]
+ );
+
+ # LWP will auto-correct Content-Length when using a remote server
+ SKIP:
+ {
+ if ( $ENV{CATALYST_SERVER} ) {
+ skip 'Using remote server', 2;
+ }
+
+ # Sending wrong Content-Length here and see if subequent requests fail
+ $request->header('Content-Length' => $request->header('Content-Length') + 1);
+
+ ok( my $response = request($request), 'Request' );
+ ok( !$response->is_success, 'Response Error' );
+ }
+
+ $request = POST(
+ 'http://localhost/dump/request',
+ 'Content-Type' => 'multipart/form-data',
+ 'Content' =>
+ [ 'file1' => ["$FindBin::Bin/../catalyst_130pix.gif"],
+ 'file2' => ["$FindBin::Bin/../catalyst_130pix.gif"], ]
+ );
+
+ ok( my $response = request($request), 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ like( $response->content, qr/file1 => bless/, 'Upload with name file1');
+ like( $response->content, qr/file2 => bless/, 'Upload with name file2');
+}
+
+{
+ my $creq;
+
+ my $request = POST(
+ 'http://localhost/dump/request/',
+ 'Content-Type' => 'form-data',
+ 'Content' => [
+ 'testfile' => 'textfield value',
+ 'testfile' => ["$FindBin::Bin/../catalyst_130pix.gif"],
+ ]
+ );
+
+ ok( my $response = request($request), 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ like(
+ $response->content,
+ qr/^bless\( .* 'Catalyst::Request' \)$/s,
+ 'Content is a serialized Catalyst::Request'
+ );
+
+ {
+ no strict 'refs';
+ ok(
+ eval '$creq = ' . $response->content,
+ 'Unserialize Catalyst::Request'
+ );
+ }
+
+ isa_ok( $creq, 'Catalyst::Request' );
+ is( $creq->method, 'POST', 'Catalyst::Request method' );
+ is( $creq->content_type, 'multipart/form-data',
+ 'Catalyst::Request Content-Type' );
+ is( $creq->content_length, $request->content_length,
+ 'Catalyst::Request Content-Length' );
+
+ my $param = $creq->parameters->{testfile};
+
+ ok( @$param == 2, '2 values' );
+ is( $param->[0], 'textfield value', 'correct value' );
+ like( $param->[1], qr/\Qcatalyst_130pix.gif/, 'filename' );
+
+ for my $part ( $request->parts ) {
+
+ my $disposition = $part->header('Content-Disposition');
+ my %parameters = @{ ( split_header_words($disposition) )[0] };
+
+ next unless exists $parameters{filename};
+
+ my $upload = $creq->uploads->{ $parameters{name} };
+
+ isa_ok( $upload, 'Catalyst::Request::Upload' );
+
+ is( $upload->type, $part->content_type, 'Upload Content-Type' );
+ is( $upload->size, length( $part->content ), 'Upload Content-Length' );
+ is( $upload->filename, 'catalyst_130pix.gif' );
+ }
+}
+
+# test uploadtmp config var
+
+{
+ my $creq;
+
+ my $dir = "$FindBin::Bin/";
+ local TestApp->config->{ uploadtmp } = $dir;
+ $dir = Path::Class::Dir->new( $dir );
+
+ my $request = POST(
+ 'http://localhost/dump/request/',
+ 'Content-Type' => 'multipart/form-data',
+ 'Content' => [
+ 'testfile' => ["$FindBin::Bin/live_engine_request_uploads.t"],
+ ]
+ );
+
+ ok( my $response = request($request), 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ like(
+ $response->content,
+ qr/^bless\( .* 'Catalyst::Request' \)$/s,
+ 'Content is a serialized Catalyst::Request'
+ );
+
+ {
+ no strict 'refs';
+ ok(
+ eval '$creq = ' . $response->content,
+ 'Unserialize Catalyst::Request'
+ );
+ }
+
+ isa_ok( $creq, 'Catalyst::Request' );
+ is( $creq->method, 'POST', 'Catalyst::Request method' );
+ is( $creq->content_type, 'multipart/form-data',
+ 'Catalyst::Request Content-Type' );
+ is( $creq->content_length, $request->content_length,
+ 'Catalyst::Request Content-Length' );
+
+ for my $part ( $request->parts ) {
+
+ my $disposition = $part->header('Content-Disposition');
+ my %parameters = @{ ( split_header_words($disposition) )[0] };
+
+ next unless exists $parameters{filename};
+
+ my $upload = $creq->{uploads}->{ $parameters{name} };
+
+ isa_ok( $upload, 'Catalyst::Request::Upload' );
+
+ is( $upload->type, $part->content_type, 'Upload Content-Type' );
+ is( $upload->size, length( $part->content ), 'Upload Content-Length' );
+
+ like( $upload->tempname, qr{\Q$dir\E}, 'uploadtmp' );
+ }
+}
+
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_engine_request_uploads.t
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_engine_request_uri.t
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_engine_request_uri.t (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_engine_request_uri.t 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,153 @@
+use strict;
+use warnings;
+
+use FindBin;
+use lib "$FindBin::Bin/../lib";
+
+use Test::More tests => 66;
+use Catalyst::Test 'TestApp';
+use Catalyst::Request;
+
+my $creq;
+
+# test that the path can be changed
+{
+ ok( my $response = request('http://localhost/engine/request/uri/change_path'), 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ ok( eval '$creq = ' . $response->content, 'Unserialize Catalyst::Request' );
+ like( $creq->uri, qr{/my/app/lives/here$}, 'URI contains new path' );
+}
+
+# test that path properly removes the base location
+{
+ ok( my $response = request('http://localhost/engine/request/uri/change_base'), 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ ok( eval '$creq = ' . $response->content, 'Unserialize Catalyst::Request' );
+ like( $creq->base, qr{/new/location}, 'Base URI contains new location' );
+ is( $creq->path, 'engine/request/uri/change_base', 'URI contains correct path' );
+}
+
+# test that base + path is correct
+{
+ ok( my $response = request('http://localhost/engine/request/uri'), 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ ok( eval '$creq = ' . $response->content, 'Unserialize Catalyst::Request' );
+ is( $creq->base . $creq->path, $creq->uri, 'Base + Path ok' );
+}
+
+# test base is correct for HTTPS URLs
+SKIP:
+{
+ if ( $ENV{CATALYST_SERVER} ) {
+ skip 'Using remote server', 5;
+ }
+
+ local $ENV{HTTPS} = 'on';
+ ok( my $response = request('https://localhost/engine/request/uri'), 'HTTPS Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ ok( eval '$creq = ' . $response->content, 'Unserialize Catalyst::Request' );
+ is( $creq->base, 'https://localhost/', 'HTTPS base ok' );
+ is( $creq->uri, 'https://localhost/engine/request/uri', 'HTTPS uri ok' );
+}
+
+# test that we can use semi-colons as separators
+{
+ my $parameters = {
+ a => [ qw/1 2/ ],
+ b => 3,
+ };
+
+ ok( my $response = request('http://localhost/engine/request/uri?a=1;a=2;b=3'), 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ ok( eval '$creq = ' . $response->content, 'Unserialize Catalyst::Request' );
+ is( $creq->uri->query, 'a=1;a=2;b=3', 'Query string ok' );
+ is_deeply( $creq->parameters, $parameters, 'Parameters ok' );
+}
+
+# test that query params are unescaped properly
+{
+ ok( my $response = request('http://localhost/engine/request/uri?text=Catalyst%20Rocks'), 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ ok( eval '$creq = ' . $response->content, 'Unserialize Catalyst::Request' );
+ is( $creq->uri->query, 'text=Catalyst%20Rocks', 'Query string ok' );
+ is( $creq->parameters->{text}, 'Catalyst Rocks', 'Unescaped param ok' );
+}
+
+# test that uri_with adds params
+{
+ ok( my $response = request('http://localhost/engine/request/uri/uri_with'), 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ ok( !defined $response->header( 'X-Catalyst-Param-a' ), 'param "a" ok' );
+ is( $response->header( 'X-Catalyst-Param-b' ), '1', 'param "b" ok' );
+}
+
+# test that uri_with adds params (and preserves)
+{
+ ok( my $response = request('http://localhost/engine/request/uri/uri_with?a=1'), 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->header( 'X-Catalyst-Param-a' ), '1', 'param "a" ok' );
+ is( $response->header( 'X-Catalyst-Param-b' ), '1', 'param "b" ok' );
+}
+
+# test that uri_with replaces params (and preserves)
+{
+ ok( my $response = request('http://localhost/engine/request/uri/uri_with?a=1&b=2'), 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->header( 'X-Catalyst-Param-a' ), '1', 'param "a" ok' );
+ is( $response->header( 'X-Catalyst-Param-b' ), '1', 'param "b" ok' );
+}
+
+# test that uri_with replaces params (and preserves)
+{
+ ok( my $response = request('http://localhost/engine/request/uri/uri_with_object'), 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ like( $response->header( 'X-Catalyst-Param-a' ), qr(https?://localhost[^/]*/), 'param "a" ok' );
+}
+
+# test that uri_with is utf8 safe
+{
+ ok( my $response = request("http://localhost/engine/request/uri/uri_with_utf8"), 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ like( $response->header( 'X-Catalyst-uri-with' ), qr/%E2%98%A0$/, 'uri_with ok' );
+}
+
+# test with undef -- no warnings should be thrown
+{
+ ok( my $response = request("http://localhost/engine/request/uri/uri_with_undef"), 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->header( 'X-Catalyst-warnings' ), 0, 'no warnings emitted' );
+}
+
+# more tests with undef - should be ignored
+{
+ my $uri = "http://localhost/engine/request/uri/uri_with_undef_only";
+ ok( my $response = request($uri), 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->header( 'X-Catalyst-uri-with' ), $uri, 'uri_with ok' );
+
+ # try with existing param
+ $uri = "$uri?x=1";
+ ok( $response = request($uri), 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->header( 'X-Catalyst-uri-with' ), $uri, 'uri_with ok' );
+}
+
+{
+ my $uri = "http://localhost/engine/request/uri/uri_with_undef_ignore";
+ ok( my $response = request($uri), 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->header( 'X-Catalyst-uri-with' ), "${uri}?a=1", 'uri_with ok' );
+
+ # remove an existing param
+ ok( $response = request("${uri}?b=1"), 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->header( 'X-Catalyst-uri-with' ), "${uri}?a=1", 'uri_with ok' );
+
+ # remove an existing param, leave one, and add a new one
+ ok( $response = request("${uri}?b=1&c=1"), 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->header( 'X-Catalyst-Param-a' ), '1', 'param "a" ok' );
+ ok( !defined $response->header( 'X-Catalyst-Param-b' ),'param "b" ok' );
+ is( $response->header( 'X-Catalyst-Param-c' ), '1', 'param "c" ok' );
+}
+
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_engine_request_uri.t
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_engine_response_cookies.t
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_engine_response_cookies.t (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_engine_response_cookies.t 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,73 @@
+#!perl
+
+use strict;
+use warnings;
+
+use FindBin;
+use lib "$FindBin::Bin/../lib";
+
+use Test::More tests => 15;
+use Catalyst::Test 'TestApp';
+use HTTP::Headers::Util 'split_header_words';
+
+my $expected = {
+ Catalyst => [qw|Catalyst Cool path /bah|],
+ Cool => [qw|Cool Catalyst path /|]
+};
+
+{
+ ok( my $response = request('http://localhost/engine/response/cookies/one'),
+ 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ is( $response->header('X-Catalyst-Action'),
+ 'engine/response/cookies/one', 'Test Action' );
+
+ my $cookies = {};
+
+ for my $string ( $response->header('Set-Cookie') ) {
+ my $cookie = [ split_header_words $string];
+ $cookies->{ $cookie->[0]->[0] } = $cookie->[0];
+ }
+
+ is_deeply( $cookies, $expected, 'Response Cookies' );
+}
+
+{
+ ok( my $response = request('http://localhost/engine/response/cookies/two'),
+ 'Request' );
+ ok( $response->is_redirect, 'Response Redirection 3xx' );
+ is( $response->code, 302, 'Response Code' );
+ is( $response->header('X-Catalyst-Action'),
+ 'engine/response/cookies/two', 'Test Action' );
+
+ my $cookies = {};
+
+ for my $string ( $response->header('Set-Cookie') ) {
+ my $cookie = [ split_header_words $string];
+ $cookies->{ $cookie->[0]->[0] } = $cookie->[0];
+ }
+
+ is_deeply( $cookies, $expected, 'Response Cookies' );
+}
+
+{
+ ok( my $response = request('http://localhost/engine/response/cookies/three'),
+ 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ is( $response->header('X-Catalyst-Action'),
+ 'engine/response/cookies/three', 'Test Action' );
+
+ my $cookies = {};
+
+ for my $string ( $response->header('Set-Cookie') ) {
+ my $cookie = [ split_header_words $string];
+ $cookies->{ $cookie->[0]->[0] } = $cookie->[0];
+ }
+
+ is_deeply( $cookies, {
+ hash => [ qw(hash a&b&c path /) ],
+ this_is_the_real_name => [ qw(this_is_the_real_name foo&bar path /) ], # not "object"
+ }, 'Response Cookies' );
+}
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_engine_response_cookies.t
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_engine_response_errors.t
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_engine_response_errors.t (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_engine_response_errors.t 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,60 @@
+#!perl
+
+use strict;
+use warnings;
+
+use FindBin;
+use lib "$FindBin::Bin/../lib";
+
+use Test::More tests => 18;
+use Catalyst::Test 'TestApp';
+
+close STDERR; # i'm naughty :)
+
+{
+ ok( my $response = request('http://localhost/engine/response/errors/one'),
+ 'Request' );
+ ok( $response->is_error, 'Response Server Error 5xx' );
+ is( $response->code, 500, 'Response Code' );
+ is( $response->content_type, 'text/html', 'Response Content-Type' );
+ is( $response->header('X-Catalyst-Action'),
+ 'engine/response/errors/one', 'Test Action' );
+ like(
+ $response->header('X-Catalyst-Error'),
+ qr/^Caught exception/,
+ 'Catalyst Error'
+ );
+}
+
+{
+ ok( my $response = request('http://localhost/engine/response/errors/two'),
+ 'Request' );
+ ok( $response->is_error, 'Response Server Error 5xx' );
+ is( $response->code, 500, 'Response Code' );
+ is( $response->content_type, 'text/html', 'Response Content-Type' );
+ is( $response->header('X-Catalyst-Action'),
+ 'engine/response/errors/two', 'Test Action' );
+ like(
+ $response->header('X-Catalyst-Error'),
+ qr/^Couldn't forward to/,
+ 'Catalyst Error'
+ );
+}
+
+{
+ ok( my $response = request('http://localhost/engine/response/errors/three'),
+ 'Request' );
+ ok( $response->is_error, 'Response Server Error 5xx' );
+ is( $response->code, 500, 'Response Code' );
+ is( $response->content_type, 'text/html', 'Response Content-Type' );
+ is(
+ $response->header('X-Catalyst-Action'),
+ 'engine/response/errors/three',
+ 'Test Action'
+ );
+ like(
+ $response->header('X-Catalyst-Error'),
+ qr/I'm going to die!/,
+ 'Catalyst Error'
+ );
+}
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_engine_response_errors.t
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_engine_response_headers.t
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_engine_response_headers.t (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_engine_response_headers.t 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,58 @@
+#!perl
+
+use strict;
+use warnings;
+
+use FindBin;
+use lib "$FindBin::Bin/../lib";
+
+use Test::More tests => 18;
+use Catalyst::Test 'TestApp';
+use HTTP::Request::Common;
+
+my $content_length;
+
+foreach my $method qw(HEAD GET) {
+ my $expected = join( ', ', 1 .. 10 );
+
+ my $request = HTTP::Request::Common->can($method)
+ ->( 'http://localhost/engine/response/headers/one' );
+
+ ok( my $response = request($request), 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->code, 200, 'Response Code' );
+ is( $response->header('X-Catalyst-Action'),
+ 'engine/response/headers/one', 'Test Action' );
+ is( $response->header('X-Header-Catalyst'),
+ 'Cool', 'Response Header X-Header-Catalyst' );
+ is( $response->header('X-Header-Cool'),
+ 'Catalyst', 'Response Header X-Header-Cool' );
+ is( $response->header('X-Header-Numbers'),
+ $expected, 'Response Header X-Header-Numbers' );
+
+ use bytes;
+ if ( $method eq 'HEAD' ) {
+ $content_length = $response->header('Content-Length');
+ ok( $content_length > 0, 'Response Header Content-Length' );
+ is( length($response->content),
+ 0,
+ 'HEAD method content is empty' );
+ }
+ elsif ( $method eq 'GET' ) {
+ # method name is echo'd back in content-body, which
+ # accounts for difference in content length. In normal
+ # cases the Content-Length should be the same regardless
+ # of if its a GET or HEAD request.
+ SKIP:
+ {
+ if ( $ENV{CATALYST_SERVER} ) {
+ skip "Using remote server", 2;
+ }
+ is( $response->header('Content-Length'),
+ $content_length - 1, 'Response Header Content-Length' );
+ is( length($response->content),
+ $response->header('Content-Length'),
+ 'GET method content' );
+ }
+ }
+}
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_engine_response_headers.t
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_engine_response_large.t
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_engine_response_large.t (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_engine_response_large.t 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,27 @@
+#!perl
+
+use strict;
+use warnings;
+
+use FindBin;
+use lib "$FindBin::Bin/../lib";
+
+use Test::More tests => 6;
+use Catalyst::Test 'TestApp';
+
+# phaylon noticed that refactored was truncating output on large images.
+# This test tests 100K and 1M output content.
+
+my $expected = {
+ one => 'x' x (100 * 1024),
+ two => 'y' x (1024 * 1024),
+};
+
+for my $action ( keys %{$expected} ) {
+ ok( my $response = request('http://localhost/engine/response/large/' . $action ),
+ 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+
+ is( length( $response->content ), length( $expected->{$action} ), 'Length OK' );
+}
+
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_engine_response_large.t
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_engine_response_redirect.t
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_engine_response_redirect.t (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_engine_response_redirect.t 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,48 @@
+#!perl
+
+use strict;
+use warnings;
+
+use FindBin;
+use lib "$FindBin::Bin/../lib";
+
+use Test::More tests => 26;
+use Catalyst::Test 'TestApp';
+
+{
+ ok( my $response = request('http://localhost/engine/response/redirect/one'), 'Request' );
+ ok( $response->is_redirect, 'Response Redirection 3xx' );
+ is( $response->code, 302, 'Response Code' );
+ is( $response->header('X-Catalyst-Action'), 'engine/response/redirect/one', 'Test Action' );
+ is( $response->header('Location'), '/test/writing/is/boring', 'Response Header Location' );
+ ok( $response->header('Content-Length'), '302 Redirect contains Content-Length' );
+ ok( $response->content, '302 Redirect contains a response body' );
+}
+
+{
+ ok( my $response = request('http://localhost/engine/response/redirect/two'), 'Request' );
+ ok( $response->is_redirect, 'Response Redirection 3xx' );
+ is( $response->code, 302, 'Response Code' );
+ is( $response->header('X-Catalyst-Action'), 'engine/response/redirect/two', 'Test Action' );
+ is( $response->header('Location'), 'http://www.google.com/', 'Response Header Location' );
+}
+
+{
+ ok( my $response = request('http://localhost/engine/response/redirect/three'), 'Request' );
+ ok( $response->is_redirect, 'Response Redirection 3xx' );
+ is( $response->code, 301, 'Response Code' );
+ is( $response->header('X-Catalyst-Action'), 'engine/response/redirect/three', 'Test Action' );
+ is( $response->header('Location'), 'http://www.google.com/', 'Response Header Location' );
+ ok( $response->header('Content-Length'), '301 Redirect contains Content-Length' );
+ ok( $response->content, '301 Redirect contains a response body' );
+}
+
+{
+ ok( my $response = request('http://localhost/engine/response/redirect/four'), 'Request' );
+ ok( $response->is_redirect, 'Response Redirection 3xx' );
+ is( $response->code, 307, 'Response Code' );
+ is( $response->header('X-Catalyst-Action'), 'engine/response/redirect/four', 'Test Action' );
+ is( $response->header('Location'), 'http://www.google.com/', 'Response Header Location' );
+ ok( $response->header('Content-Length'), '307 Redirect contains Content-Length' );
+ ok( $response->content, '307 Redirect contains a response body' );
+}
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_engine_response_redirect.t
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_engine_response_status.t
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_engine_response_status.t (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_engine_response_status.t 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,55 @@
+#!perl
+
+use strict;
+use warnings;
+
+use FindBin;
+use lib "$FindBin::Bin/../lib";
+
+use Test::More tests => 30;
+use Catalyst::Test 'TestApp';
+
+{
+ ok( my $response = request('http://localhost/engine/response/status/s200'), 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->code, 200, 'Response Code' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ is( $response->header('X-Catalyst-Action'), 'engine/response/status/s200', 'Test Action' );
+ like( $response->content, qr/^200/, 'Response Content' );
+}
+
+{
+ ok( my $response = request('http://localhost/engine/response/status/s400'), 'Request' );
+ ok( $response->is_error, 'Response Client Error 4xx' );
+ is( $response->code, 400, 'Response Code' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ is( $response->header('X-Catalyst-Action'), 'engine/response/status/s400', 'Test Action' );
+ like( $response->content, qr/^400/, 'Response Content' );
+}
+
+{
+ ok( my $response = request('http://localhost/engine/response/status/s403'), 'Request' );
+ ok( $response->is_error, 'Response Client Error 4xx' );
+ is( $response->code, 403, 'Response Code' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ is( $response->header('X-Catalyst-Action'), 'engine/response/status/s403', 'Test Action' );
+ like( $response->content, qr/^403/, 'Response Content' );
+}
+
+{
+ ok( my $response = request('http://localhost/engine/response/status/s404'), 'Request' );
+ ok( $response->is_error, 'Response Client Error 4xx' );
+ is( $response->code, 404, 'Response Code' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ is( $response->header('X-Catalyst-Action'), 'engine/response/status/s404', 'Test Action' );
+ like( $response->content, qr/^404/, 'Response Content' );
+}
+
+{
+ ok( my $response = request('http://localhost/engine/response/status/s500'), 'Request' );
+ ok( $response->is_error, 'Response Server Error 5xx' );
+ is( $response->code, 500, 'Response Code' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ is( $response->header('X-Catalyst-Action'), 'engine/response/status/s500', 'Test Action' );
+ like( $response->content, qr/^500/, 'Response Content' );
+}
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_engine_response_status.t
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_engine_setup_basics.t
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_engine_setup_basics.t (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_engine_setup_basics.t 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,19 @@
+#!perl
+
+use strict;
+use warnings;
+
+use FindBin;
+use lib "$FindBin::Bin/../lib";
+
+use Test::More tests => 1;
+use Catalyst::Test 'TestApp';
+
+SKIP:
+{
+ if ( $ENV{CATALYST_SERVER} ) {
+ skip "Using remote server", 1;
+ }
+ # Allow overriding automatic root.
+ is( TestApp->config->{root}, '/some/dir' );
+}
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_engine_setup_basics.t
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_engine_setup_plugins.t
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_engine_setup_plugins.t (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_engine_setup_plugins.t 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,16 @@
+#!perl
+
+use strict;
+use warnings;
+
+use FindBin;
+use lib "$FindBin::Bin/../lib";
+
+use Test::More tests => 2;
+use Catalyst::Test 'TestApp';
+
+{
+ # Allow overriding automatic root.
+ ok( my $response = request('http://localhost/engine/response/headers/one'), 'Request' );
+ is( $response->header('X-Catalyst-Plugin-Setup'), '1' );
+}
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_engine_setup_plugins.t
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_loop.t
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_loop.t (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_loop.t 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,23 @@
+#!perl
+
+use strict;
+use warnings;
+
+use FindBin;
+use lib "$FindBin::Bin/../lib";
+
+use Test::More tests => 3;
+use Catalyst::Test 'TestApp';
+
+SKIP:
+{
+ # Net::HTTP::Methods crashes when talking to a remote server because this
+ # test causes a very long header line to be sent
+ if ( $ENV{CATALYST_SERVER} ) {
+ skip 'Using remote server', 3;
+ }
+
+ ok( my $response = request('http://localhost/loop_test'), 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ ok( $response->header('X-Class-Forward-Test-Method'), 'Loop OK' );
+}
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_loop.t
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_plugin_loaded.t
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_plugin_loaded.t (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_plugin_loaded.t 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,27 @@
+#!perl
+
+use strict;
+use warnings;
+
+use FindBin;
+use lib "$FindBin::Bin/../lib";
+
+use Test::More tests => 5;
+use Catalyst::Test 'TestApp';
+
+my @expected = qw[
+ Catalyst::Plugin::Test::Errors
+ Catalyst::Plugin::Test::Headers
+ Catalyst::Plugin::Test::Inline
+ Catalyst::Plugin::Test::Plugin
+ TestApp::Plugin::FullyQualified
+];
+
+my $expected = join( ", ", @expected );
+
+ok( my $response = request('http://localhost/dump/request'), 'Request' );
+ok( $response->is_success, 'Response Successful 2xx' );
+is( $response->content_type, 'text/plain', 'Response Content-Type' );
+like( $response->content, qr/'Catalyst::Request'/,
+ 'Content is a serialized Catalyst::Request' );
+is( $response->header('X-Catalyst-Plugins'), $expected, 'Loaded plugins' );
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_plugin_loaded.t
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_priorities.t
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_priorities.t (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_priorities.t 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,80 @@
+#!perl
+
+use strict;
+use warnings;
+
+use FindBin;
+use lib "$FindBin::Bin/../lib";
+
+use Test::More tests => 28;
+use Catalyst::Test 'TestApp';
+
+local $^W = 0;
+
+my $uri_base = 'http://localhost/priorities';
+my @tests = (
+
+ # Simple
+ 'Regex vs. Local', { path => '/re_vs_loc', expect => 'local' },
+ 'Regex vs. LocalRegex', { path => '/re_vs_locre', expect => 'regex' },
+ 'Regex vs. Path', { path => '/re_vs_path', expect => 'path' },
+ 'Local vs. LocalRegex', { path => '/loc_vs_locre', expect => 'local' },
+ 'Local vs. Path 1', { path => '/loc_vs_path1', expect => 'local' },
+ 'Local vs. Path 2', { path => '/loc_vs_path2', expect => 'path' },
+ 'Path vs. LocalRegex', { path => '/path_vs_locre', expect => 'path' },
+
+ # index
+ 'index vs. Regex', { path => '/re_vs_index', expect => 'index' },
+ 'index vs. Local', { path => '/loc_vs_index', expect => 'index' },
+ 'index vs. LocalRegex', { path => '/locre_vs_index', expect => 'index' },
+ 'index vs. Path', { path => '/path_vs_index', expect => 'index' },
+
+ 'multimethod zero', { path => '/multimethod', expect => 'zero' },
+ 'multimethod one', { path => '/multimethod/1', expect => 'one 1' },
+ 'multimethod two', { path => '/multimethod/1/2',
+ expect => 'two 1 2' },
+);
+
+while ( @tests ) {
+
+ my $name = shift @tests;
+ my $data = shift @tests;
+
+ # Run tests for path with trailing slash and without
+ SKIP: for my $req_uri
+ (
+ join( '' => $uri_base, $data->{ path } ), # Without trailing path
+ join( '' => $uri_base, $data->{ path }, '/' ), # With trailing path
+ ) {
+ my $end_slash = ( $req_uri =~ qr(/$) ? 1 : 0 );
+
+ # use slash_expect argument if URI ends with slash
+ # and the slash_expect argument is defined
+ my $expect = $data->{ expect } || '';
+ if ( $end_slash and exists $data->{ slash_expect } ) {
+ $expect = $data->{ slash_expect };
+ }
+
+ # Call the URI on the TestApp
+ my $response = request( $req_uri );
+
+ # Leave expect out to see the result
+ unless ( $expect ) {
+ skip 'Nothing expected, winner is ' . $response->content, 1;
+ }
+
+ # Show error if response was no success
+ if ( not $response->is_success ) {
+ diag 'Error: ' . $response->headers->{ 'x-catalyst-error' };
+ }
+
+ # Test if content matches expectations.
+ # TODO This might flood the screen with the catalyst please-come-later
+ # page. So I don't know it is a good idea.
+ is( $response->content, $expect,
+ "$name: @{[ $data->{ expect } ]} wins"
+ . ( $end_slash ? ' (trailing slash)' : '' )
+ );
+ }
+}
+
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_priorities.t
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_recursion.t
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_recursion.t (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_recursion.t 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,25 @@
+#!perl
+
+use strict;
+use warnings;
+
+use FindBin;
+use lib "$FindBin::Bin/../lib";
+
+use Test::More tests => 3;
+use Catalyst::Test 'TestApp';
+
+local $^W = 0;
+
+SKIP:
+{
+ # Net::HTTP::Methods crashes when talking to a remote server because this
+ # test causes a very long header line to be sent
+ if ( $ENV{CATALYST_SERVER} ) {
+ skip 'Using remote server', 3;
+ }
+
+ ok( my $response = request('http://localhost/recursion_test'), 'Request' );
+ ok( !$response->is_success, 'Response Not Successful' );
+ is( $response->header('X-Catalyst-Error'), 'Deep recursion detected calling "/recursion_test"', 'Deep Recursion Detected' );
+}
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/aggregate/live_recursion.t
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/lib/Catalyst/Action/TestAfter.pm
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/lib/Catalyst/Action/TestAfter.pm (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/lib/Catalyst/Action/TestAfter.pm 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,15 @@
+package Catalyst::Action::TestAfter;
+
+use strict;
+use warnings;
+
+use base qw/Catalyst::Action/;
+
+sub execute {
+ my $self = shift;
+ my ( $controller, $c ) = @_;
+ $self->NEXT::execute( @_ );
+ $c->res->header( 'X-Action-After', $c->stash->{after_message} );
+}
+
+1;
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/lib/Catalyst/Action/TestAfter.pm
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/lib/Catalyst/Action/TestBefore.pm
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/lib/Catalyst/Action/TestBefore.pm (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/lib/Catalyst/Action/TestBefore.pm 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,15 @@
+package Catalyst::Action::TestBefore;
+
+use strict;
+use warnings;
+
+use base qw/Catalyst::Action/;
+
+sub execute {
+ my $self = shift;
+ my ( $controller, $c ) = @_;
+ $c->stash->{test} = 'works';
+ $self->NEXT::execute( @_ );
+}
+
+1;
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/lib/Catalyst/Action/TestBefore.pm
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/lib/Catalyst/Plugin/Test/Errors.pm
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/lib/Catalyst/Plugin/Test/Errors.pm (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/lib/Catalyst/Plugin/Test/Errors.pm 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,33 @@
+package Catalyst::Plugin::Test::Errors;
+
+use strict;
+use NEXT;
+
+sub error {
+ my $c = shift;
+
+ unless ( $_[0] ) {
+ return $c->NEXT::error(@_);
+ }
+
+ if ( $_[0] =~ /^(Unknown resource|No default action defined)/ ) {
+ $c->response->status(404);
+ }
+
+ if ( $_[0] =~ /^Couldn\'t forward/ ) {
+ $c->response->status(404);
+ }
+
+ if ( $_[0] =~ /^Caught exception/ ) {
+ $c->response->status(500);
+ }
+
+ my $error = $_[0];
+ $error =~ s/\n/, /g;
+
+ $c->response->headers->push_header( 'X-Catalyst-Error' => $error );
+
+ $c->NEXT::error(@_);
+}
+
+1;
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/lib/Catalyst/Plugin/Test/Errors.pm
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/lib/Catalyst/Plugin/Test/Headers.pm
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/lib/Catalyst/Plugin/Test/Headers.pm (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/lib/Catalyst/Plugin/Test/Headers.pm 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,34 @@
+package Catalyst::Plugin::Test::Headers;
+
+use strict;
+use NEXT;
+
+sub prepare {
+ my $class = shift;
+
+ my $c = $class->NEXT::prepare(@_);
+
+ $c->response->header( 'X-Catalyst-Engine' => $c->engine );
+ $c->response->header( 'X-Catalyst-Debug' => $c->debug ? 1 : 0 );
+
+ {
+ my $components = join( ', ', sort keys %{ $c->components } );
+ $c->response->header( 'X-Catalyst-Components' => $components );
+ }
+
+ {
+ no strict 'refs';
+ my $plugins = join ', ', $class->registered_plugins;
+ $c->response->header( 'X-Catalyst-Plugins' => $plugins );
+ }
+
+ return $c;
+}
+
+sub prepare_action {
+ my $c = shift;
+ $c->NEXT::prepare_action(@_);
+ $c->res->header( 'X-Catalyst-Action' => $c->req->action );
+}
+
+1;
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/lib/Catalyst/Plugin/Test/Headers.pm
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/lib/Catalyst/Plugin/Test/Plugin.pm
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/lib/Catalyst/Plugin/Test/Plugin.pm (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/lib/Catalyst/Plugin/Test/Plugin.pm 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,30 @@
+package Catalyst::Plugin::Test::Plugin;
+
+use strict;
+use NEXT;
+
+use base qw/Catalyst::Base Class::Data::Inheritable/;
+
+ __PACKAGE__->mk_classdata('ran_setup');
+
+sub setup {
+ my $c = shift;
+ $c->ran_setup('1');
+}
+
+sub prepare {
+
+ my $class = shift;
+
+ my $c = $class->NEXT::prepare(@_);
+ $c->response->header( 'X-Catalyst-Plugin-Setup' => $c->ran_setup );
+
+ return $c;
+
+}
+
+sub end : Private {
+ my ($self,$c) = @_;
+}
+
+1;
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/lib/Catalyst/Plugin/Test/Plugin.pm
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/lib/PluginTestApp.pm
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/lib/PluginTestApp.pm (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/lib/PluginTestApp.pm 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,67 @@
+package PluginTestApp;
+use Test::More;
+
+use Catalyst qw(
+ Test::Plugin
+ +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 ],
+ [
+ qw/Catalyst::Plugin::Test::Plugin
+ TestApp::Plugin::FullyQualified/
+ ],
+ '... and it should report the correct plugins';
+ ok $c->registered_plugins('Catalyst::Plugin::Test::Plugin'),
+ '... or if we have a particular plugin';
+ ok $c->registered_plugins('Test::Plugin'),
+ '... even if it is not fully qualified';
+ ok !$c->registered_plugins('No::Such::Plugin'),
+ '... and it should return false if the plugin does not exist';
+}
+
+__PACKAGE__->setup;
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/lib/PluginTestApp.pm
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Action/TestBefore.pm
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Action/TestBefore.pm (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Action/TestBefore.pm 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,15 @@
+package TestApp::Action::TestBefore;
+
+use strict;
+use warnings;
+
+use base qw/Catalyst::Action/;
+
+sub execute {
+ my $self = shift;
+ my ( $controller, $c, $test ) = @_;
+ $c->res->header( 'X-TestAppActionTestBefore', $test );
+ $self->NEXT::execute( @_ );
+}
+
+1;
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Action/TestBefore.pm
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Action/TestMyAction.pm
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Action/TestMyAction.pm (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Action/TestMyAction.pm 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,16 @@
+package TestApp::Action::TestMyAction;
+
+use strict;
+use warnings;
+
+use base qw/Catalyst::Action/;
+
+sub execute {
+ my $self = shift;
+ my ( $controller, $c, $test ) = @_;
+ $c->res->header( 'X-TestAppActionTestMyAction', 'MyAction works' );
+ $self->NEXT::execute(@_);
+}
+
+1;
+
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Action/TestMyAction.pm
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Action.pm
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Action.pm (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Action.pm 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,28 @@
+package TestApp::Controller::Action::Action;
+
+use strict;
+use base 'TestApp::Controller::Action';
+
+sub action_action_one : Global : ActionClass('TestBefore') {
+ my ( $self, $c ) = @_;
+ $c->res->header( 'X-Action', $c->stash->{test} );
+ $c->forward('TestApp::View::Dump::Request');
+}
+
+sub action_action_two : Global : ActionClass('TestAfter') {
+ my ( $self, $c ) = @_;
+ $c->stash->{after_message} = 'awesome';
+ $c->forward('TestApp::View::Dump::Request');
+}
+
+sub action_action_three : Global : ActionClass('+TestApp::Action::TestBefore') {
+ my ( $self, $c ) = @_;
+ $c->forward('TestApp::View::Dump::Request');
+}
+
+sub action_action_four : Global : MyAction('TestMyAction') {
+ my ( $self, $c ) = @_;
+ $c->forward('TestApp::View::Dump::Request');
+}
+
+1;
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Action.pm
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Auto/Abort.pm
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Auto/Abort.pm (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Auto/Abort.pm 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,26 @@
+package TestApp::Controller::Action::Auto::Abort;
+
+use strict;
+use base 'TestApp::Controller::Action';
+
+sub auto : Private {
+ my ( $self, $c ) = @_;
+ return 0;
+}
+
+sub default : Private {
+ my ( $self, $c ) = @_;
+ $c->res->body( 'abort default' );
+}
+
+sub end : Private {
+ my ( $self, $c ) = @_;
+ $c->res->body( 'abort end' ) unless $c->res->body;
+}
+
+sub one : Local {
+ my ( $self, $c ) = @_;
+ $c->res->body( 'abort one' );
+}
+
+1;
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Auto/Abort.pm
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Auto/Deep.pm
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Auto/Deep.pm (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Auto/Deep.pm 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,21 @@
+package TestApp::Controller::Action::Auto::Deep;
+
+use strict;
+use base 'TestApp::Controller::Action';
+
+sub auto : Private {
+ my ( $self, $c ) = @_;
+ return 1;
+}
+
+sub default : Private {
+ my ( $self, $c ) = @_;
+ $c->res->body( 'deep default' );
+}
+
+sub one : Local {
+ my ( $self, $c ) = @_;
+ $c->res->body( 'deep one' );
+}
+
+1;
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Auto/Deep.pm
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Auto/Default.pm
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Auto/Default.pm (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Auto/Default.pm 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,22 @@
+package TestApp::Controller::Action::Auto::Default;
+
+use strict;
+use base 'TestApp::Controller::Action';
+
+sub begin : Private { }
+
+sub auto : Private {
+ my ( $self, $c ) = @_;
+ $c->stash->{auto_ran}++;
+ return 1;
+}
+
+sub default : Private {
+ my ( $self, $c ) = @_;
+ $c->res->body( sprintf 'default (auto: %d)', $c->stash->{auto_ran} );
+}
+
+sub end : Private { }
+
+1;
+
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Auto/Default.pm
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Auto.pm
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Auto.pm (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Auto.pm 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,21 @@
+package TestApp::Controller::Action::Auto;
+
+use strict;
+use base 'TestApp::Controller::Action';
+
+sub auto : Private {
+ my ( $self, $c ) = @_;
+ return 1;
+}
+
+sub default : Private {
+ my ( $self, $c ) = @_;
+ $c->res->body( 'default' );
+}
+
+sub one : Local {
+ my ( $self, $c ) = @_;
+ $c->res->body( 'one' );
+}
+
+1;
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Auto.pm
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Begin.pm
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Begin.pm (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Begin.pm 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,16 @@
+package TestApp::Controller::Action::Begin;
+
+use strict;
+use base 'TestApp::Controller::Action';
+
+sub begin : Private {
+ my ( $self, $c ) = @_;
+ $self->SUPER::begin($c);
+}
+
+sub default : Private {
+ my ( $self, $c ) = @_;
+ $c->forward('TestApp::View::Dump::Request');
+}
+
+1;
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Begin.pm
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Chained/ArgsOrder.pm
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Chained/ArgsOrder.pm (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Chained/ArgsOrder.pm 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,35 @@
+package TestApp::Controller::Action::Chained::ArgsOrder;
+use warnings;
+use strict;
+
+use base qw( Catalyst::Controller );
+
+#
+# This controller builds a simple chain of three actions that
+# will output the arguments they got passed to @_ after the
+# context object. We do this to test if that passing works
+# as it should.
+#
+
+sub base :Chained('/') PathPart('argsorder') CaptureArgs(0) {
+ my ( $self, $c, $arg ) = @_;
+ push @{ $c->stash->{ passed_args } }, 'base', $arg;
+}
+
+sub index :Chained('base') PathPart('') Args(0) {
+ my ( $self, $c, $arg ) = @_;
+ push @{ $c->stash->{ passed_args } }, 'index', $arg;
+}
+
+sub all :Chained('base') PathPart('') Args() {
+ my ( $self, $c, $arg ) = @_;
+ push @{ $c->stash->{ passed_args } }, 'all', $arg;
+}
+
+sub end : Private {
+ my ( $self, $c ) = @_;
+ no warnings 'uninitialized';
+ $c->response->body( join '; ', @{ $c->stash->{ passed_args } } );
+}
+
+1;
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Chained/ArgsOrder.pm
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Chained/Auto/Bar.pm
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Chained/Auto/Bar.pm (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Chained/Auto/Bar.pm 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,16 @@
+package TestApp::Controller::Action::Chained::Auto::Bar;
+use warnings;
+use strict;
+
+use base qw( Catalyst::Controller );
+
+#
+# Test chain reaction if auto action returns 0.
+#
+sub auto : Private { 0 }
+
+sub barend : Chained('.') Args(1) { }
+
+sub crossloose : Chained PathPart('chained/auto_cross') CaptureArgs(1) { }
+
+1;
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Chained/Auto/Bar.pm
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Chained/Auto/Detach.pm
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Chained/Auto/Detach.pm (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Chained/Auto/Detach.pm 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,18 @@
+package TestApp::Controller::Action::Chained::Auto::Detach;
+use warnings;
+use strict;
+
+use base qw( Catalyst::Controller );
+
+#
+# For testing behaviour of a detaching auto action in a chain.
+#
+sub auto : Private {
+ my ( $self, $c ) = @_;
+ $c->detach( '/action/chained/auto/fw3' );
+ return 1;
+}
+
+sub detachend : Chained('/action/chained/auto/dt1') Args(1) { }
+
+1;
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Chained/Auto/Detach.pm
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Chained/Auto/Foo.pm
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Chained/Auto/Foo.pm (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Chained/Auto/Foo.pm 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,16 @@
+package TestApp::Controller::Action::Chained::Auto::Foo;
+use warnings;
+use strict;
+
+use base qw( Catalyst::Controller );
+
+#
+# Test chain reaction if auto action returns 1.
+#
+sub auto : Private { 1 }
+
+sub fooend : Chained('.') Args(1) { }
+
+sub crossend : Chained('/action/chained/auto/bar/crossloose') Args(1) { }
+
+1;
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Chained/Auto/Foo.pm
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Chained/Auto/Forward.pm
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Chained/Auto/Forward.pm (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Chained/Auto/Forward.pm 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,18 @@
+package TestApp::Controller::Action::Chained::Auto::Forward;
+use warnings;
+use strict;
+
+use base qw( Catalyst::Controller );
+
+#
+# For testing behaviour of a forwarding auto action in a chain.
+#
+sub auto : Private {
+ my ( $self, $c ) = @_;
+ $c->forward( '/action/chained/auto/fw3' );
+ return 1;
+}
+
+sub forwardend : Chained('/action/chained/auto/fw1') Args(1) { }
+
+1;
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Chained/Auto/Forward.pm
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Chained/Auto.pm
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Chained/Auto.pm (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Chained/Auto.pm 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,33 @@
+package TestApp::Controller::Action::Chained::Auto;
+use warnings;
+use strict;
+
+use base qw( Catalyst::Controller );
+
+#
+# Provided for sub-auto tests. This just always returns true.
+#
+sub auto : Private { 1 }
+
+#
+# Simple chains with auto actions returning 1 and 0
+#
+sub foo : Chained PathPart('chained/autochain1') CaptureArgs(1) { }
+sub bar : Chained PathPart('chained/autochain2') CaptureArgs(1) { }
+
+#
+# Detaching out of an auto action.
+#
+sub dt1 : Chained PathPart('chained/auto_detach') CaptureArgs(1) { }
+
+#
+# Forwarding out of an auto action.
+#
+sub fw1 : Chained PathPart('chained/auto_forward') CaptureArgs(1) { }
+
+#
+# Target for dispatch and forward tests.
+#
+sub fw3 : Private { }
+
+1;
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Chained/Auto.pm
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Chained/Bar.pm
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Chained/Bar.pm (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Chained/Bar.pm 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,14 @@
+package TestApp::Controller::Action::Chained::Bar;
+
+use strict;
+use warnings;
+
+use base qw/Catalyst::Controller/;
+
+#
+# Redispatching between controllers that are not in a parent/child
+# relation. This is the root.
+#
+sub cross1 :PathPart('chained/cross') :CaptureArgs(1) :Chained('/') { }
+
+1;
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Chained/Bar.pm
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Chained/Foo.pm
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Chained/Foo.pm (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Chained/Foo.pm 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,39 @@
+package TestApp::Controller::Action::Chained::Foo;
+
+use strict;
+use warnings;
+
+use base qw/Catalyst::Controller/;
+
+#
+# Child of current namespace
+#
+sub spoon :Chained('.') :Args(0) { }
+
+#
+# Root for a action in a "parent" controller
+#
+sub higher_root :PathPart('chained/higher_root') :Chained('/') :CaptureArgs(1) { }
+
+#
+# Parent controller -> this subcontroller -> parent controller test
+#
+sub pcp2 :Chained('/action/chained/pcp1') :CaptureArgs(1) { }
+
+#
+# Controllers not in parent/child relation. This tests the end.
+#
+sub cross2 :PathPart('end') :Chained('/action/chained/bar/cross1') :Args(1) { }
+
+#
+# Create a uri to the root index
+#
+sub to_root : Chained('/') PathPart('action/chained/to_root') {
+ my ( $self, $c ) = @_;
+ my $uri = $c->uri_for(
+ $c->controller('Root')->action_for('chain_root_index') );
+ $c->res->body( "URI:$uri" );
+ $c->stash->{no_end}++;
+}
+
+1;
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Chained/Foo.pm
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Chained/ParentChain/Relative.pm
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Chained/ParentChain/Relative.pm (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Chained/ParentChain/Relative.pm 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,10 @@
+package TestApp::Controller::Action::Chained::ParentChain::Relative;
+use warnings;
+use strict;
+
+use base qw/ Catalyst::Controller /;
+
+# using ../ to go up more than one level
+sub chained_rel_two : Chained('../../one') Args(2) { }
+
+1;
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Chained/ParentChain/Relative.pm
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Chained/ParentChain.pm
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Chained/ParentChain.pm (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Chained/ParentChain.pm 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,25 @@
+package TestApp::Controller::Action::Chained::ParentChain;
+use warnings;
+use strict;
+
+use base qw/ Catalyst::Controller /;
+
+#
+# Chains to the action /action/chained/parentchain in the
+# Action::Chained controller.
+#
+sub child :Chained('.') :Args(1) { }
+
+# Should be at /chained/rootdef/*/chained_rel/*/*
+sub chained_rel :Chained('../one') Args(2) {
+}
+
+# Should chain to loose in parent namespace - i.e. at /chained/loose/*/loose/*/*
+sub loose : ChainedParent Args(2) {
+}
+
+# Should be at /chained/cross/*/up_down/*
+sub up_down : Chained('../bar/cross1') Args(1) {
+}
+
+1;
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Chained/ParentChain.pm
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Chained/PassedArgs.pm
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Chained/PassedArgs.pm (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Chained/PassedArgs.pm 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,34 @@
+package TestApp::Controller::Action::Chained::PassedArgs;
+use warnings;
+use strict;
+
+use base qw( Catalyst::Controller );
+
+#
+# This controller builds a simple chain of three actions that
+# will output the arguments they got passed to @_ after the
+# context object. We do this to test if that passing works
+# as it should.
+#
+
+sub first : PathPart('chained/passedargs/a') Chained('/') CaptureArgs(1) {
+ my ( $self, $c, $arg ) = @_;
+ $c->stash->{ passed_args } = [ $arg ];
+}
+
+sub second : PathPart('b') Chained('first') CaptureArgs(1) {
+ my ( $self, $c, $arg ) = @_;
+ push @{ $c->stash->{ passed_args } }, $arg;
+}
+
+sub third : PathPart('c') Chained('second') Args(1) {
+ my ( $self, $c, $arg ) = @_;
+ push @{ $c->stash->{ passed_args } }, $arg;
+}
+
+sub end : Private {
+ my ( $self, $c ) = @_;
+ $c->response->body( join '; ', @{ $c->stash->{ passed_args } } );
+}
+
+1;
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Chained/PassedArgs.pm
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Chained/PathPrefix.pm
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Chained/PathPrefix.pm (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Chained/PathPrefix.pm 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,12 @@
+package TestApp::Controller::Action::Chained::PathPrefix;
+
+use strict;
+use warnings;
+
+use base qw/Catalyst::Controller/;
+
+# this is kinda the same thing as: sub instance : Path {}
+# it should respond to: /action/chained/pathprefix/*
+sub instance : Chained('/') PathPrefix Args(1) { }
+
+1;
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Chained/PathPrefix.pm
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Chained/Root.pm
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Chained/Root.pm (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Chained/Root.pm 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,13 @@
+package TestApp::Controller::Action::Chained::Root;
+
+use strict;
+use warnings;
+
+use base qw( Catalyst::Controller );
+
+__PACKAGE__->config->{namespace} = '';
+
+sub rootsub : PathPart Chained( '/' ) CaptureArgs( 1 ) { }
+sub endpointsub : PathPart Chained( 'rootsub' ) Args( 1 ) { }
+
+1;
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Chained/Root.pm
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Chained.pm
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Chained.pm (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Chained.pm 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,196 @@
+package TestApp::Controller::Action::Chained;
+
+use strict;
+use warnings;
+
+use base qw/Catalyst::Controller/;
+
+sub begin :Private { }
+
+#
+# TODO
+# :Chained('') means what?
+#
+
+#
+# Simple parent/child action test
+#
+sub foo :PathPart('chained/foo') :CaptureArgs(1) :Chained('/') { }
+sub endpoint :PathPart('end') :Chained('/action/chained/foo') :Args(1) { }
+
+#
+# Parent/child test with two args each
+#
+sub foo2 :PathPart('chained/foo2') :CaptureArgs(2) :Chained('/') { }
+sub endpoint2 :PathPart('end2') :Chained('/action/chained/foo2') :Args(2) { }
+
+#
+# Relative specification of parent action
+#
+sub bar :PathPart('chained/bar') :Chained('/') :CaptureArgs(0) { }
+sub finale :PathPart('') :Chained('bar') :Args { }
+
+#
+# three chain with concurrent endpoints
+#
+sub one :PathPart('chained/one') :Chained('/') :CaptureArgs(1) { }
+sub two :PathPart('two') :Chained('/action/chained/one') :CaptureArgs(2) { }
+sub three_end :PathPart('three') :Chained('two') :Args(3) { }
+sub one_end :PathPart('chained/one') :Chained('/') :Args(1) { }
+sub two_end :PathPart('two') :Chained('one') :Args(2) { }
+
+#
+# Dispatch on number of arguments
+#
+sub multi1 :PathPart('chained/multi') :Chained('/') :Args(1) { }
+sub multi2 :PathPart('chained/multi') :Chained('/') :Args(2) { }
+
+#
+# Roots in an action defined in a higher controller
+#
+sub higher_root :PathPart('bar') :Chained('/action/chained/foo/higher_root') :Args(1) { }
+
+#
+# Controller -> subcontroller -> controller
+#
+sub pcp1 :PathPart('chained/pcp1') :Chained('/') :CaptureArgs(1) { }
+sub pcp3 :Chained('/action/chained/foo/pcp2') :Args(1) { }
+
+#
+# Dispatch on capture number
+#
+sub multi_cap1 :PathPart('chained/multi_cap') :Chained('/') :CaptureArgs(1) { }
+sub multi_cap2 :PathPart('chained/multi_cap') :Chained('/') :CaptureArgs(2) { }
+sub multi_cap_end1 :PathPart('baz') :Chained('multi_cap1') :Args(0) { }
+sub multi_cap_end2 :PathPart('baz') :Chained('multi_cap2') :Args(0) { }
+
+#
+# Priority: Slurpy args vs. chained actions
+#
+sub priority_a1 :PathPart('chained/priority_a') :Chained('/') :Args { }
+sub priority_a2 :PathPart('chained/priority_a') :Chained('/') :CaptureArgs(1) { }
+sub priority_a2_end :PathPart('end') :Chained('priority_a2') :Args(1) { }
+
+
+#
+# Priority: Fixed args vs. chained actions
+#
+sub priority_b1 :PathPart('chained/priority_b') :Chained('/') :Args(3) { }
+sub priority_b2 :PathPart('chained/priority_b') :Chained('/') :CaptureArgs(1) { }
+sub priority_b2_end :PathPart('end') :Chained('priority_b2') :Args(1) { }
+
+#
+# Priority: With no Args()
+#
+sub priority_c1 :PathPart('chained/priority_c') :Chained('/') :CaptureArgs(1) { }
+sub priority_c2 :PathPart('') :Chained('priority_c1') { }
+sub priority_c2_xyz :PathPart('xyz') :Chained('priority_c1') { }
+
+
+#
+# Optional specification of :Args in endpoint
+#
+sub opt_args :PathPart('chained/opt_args') :Chained('/') { }
+
+#
+# Optional PathPart test -> /chained/optpp/*/opt_pathpart/*
+#
+sub opt_pp_start :Chained('/') :PathPart('chained/optpp') :CaptureArgs(1) { }
+sub opt_pathpart :Chained('opt_pp_start') :Args(1) { }
+
+#
+# Optional Args *and* PathPart -> /chained/optall/*/oa/...
+#
+sub opt_all_start :Chained('/') :PathPart('chained/optall') :CaptureArgs(1) { }
+sub oa :Chained('opt_all_start') { }
+
+#
+# :Chained is the same as :Chained('/')
+#
+sub rootdef :Chained :PathPart('chained/rootdef') :Args(1) { }
+
+#
+# the ParentChain controller chains to this action by
+# specifying :Chained('.')
+#
+sub parentchain :Chained('/') :PathPart('chained/parentchain') :CaptureArgs(1) { }
+
+#
+# This is just for a test that a loose end is not callable
+#
+sub loose :Chained :PathPart('chained/loose') CaptureArgs(1) { }
+
+#
+# Forwarding out of the middle of a chain.
+#
+sub chain_fw_a :Chained :PathPart('chained/chain_fw') :CaptureArgs(1) {
+ $_[1]->forward( '/action/chained/fw_dt_target' );
+}
+sub chain_fw_b :Chained('chain_fw_a') :PathPart('end') :Args(1) { }
+
+#
+# Detaching out of the middle of a chain.
+#
+sub chain_dt_a :Chained :PathPart('chained/chain_dt') :CaptureArgs(1) {
+ $_[1]->detach( '/action/chained/fw_dt_target' );
+}
+sub chain_dt_b :Chained('chain_dt_a') :PathPart('end') :Args(1) { }
+
+#
+# Target for former forward and chain tests.
+#
+sub fw_dt_target :Private { }
+
+#
+# Test multiple chained actions with no captures
+#
+sub empty_chain_a : Chained('/') PathPart('chained/empty') CaptureArgs(0) { }
+sub empty_chain_b : Chained('empty_chain_a') PathPart('') CaptureArgs(0) { }
+sub empty_chain_c : Chained('empty_chain_b') PathPart('') CaptureArgs(0) { }
+sub empty_chain_d : Chained('empty_chain_c') PathPart('') CaptureArgs(1) { }
+sub empty_chain_e : Chained('empty_chain_d') PathPart('') CaptureArgs(0) { }
+sub empty_chain_f : Chained('empty_chain_e') PathPart('') Args(1) { }
+
+sub mult_nopp_base : Chained('/') PathPart('chained/mult_nopp') CaptureArgs(0) { }
+sub mult_nopp_all : Chained('mult_nopp_base') PathPart('') Args(0) { }
+sub mult_nopp_new : Chained('mult_nopp_base') PathPart('new') Args(0) { }
+sub mult_nopp_id : Chained('mult_nopp_base') PathPart('') CaptureArgs(1) { }
+sub mult_nopp_idall : Chained('mult_nopp_id') PathPart('') Args(0) { }
+sub mult_nopp_idnew : Chained('mult_nopp_id') PathPart('new') Args(0) { }
+
+#
+# Test Choice between branches and early return logic
+# Declaration order is important for $children->{$*}, since this is first match best.
+#
+sub cc_base : Chained('/') PathPart('chained/choose_capture') CaptureArgs(0) { }
+sub cc_link : Chained('cc_base') PathPart('') CaptureArgs(0) { }
+sub cc_anchor : Chained('cc_link') PathPart('anchor.html') Args(0) { }
+sub cc_all : Chained('cc_base') PathPart('') Args() { }
+
+sub cc_a : Chained('cc_base') PathPart('') CaptureArgs(1) { }
+sub cc_a_link : Chained('cc_a') PathPart('a') CaptureArgs(0) { }
+sub cc_a_anchor : Chained('cc_a_link') PathPart('') Args() { }
+
+sub cc_b : Chained('cc_base') PathPart('b') CaptureArgs(0) { }
+sub cc_b_link : Chained('cc_b') PathPart('') CaptureArgs(1) { }
+sub cc_b_anchor : Chained('cc_b_link') PathPart('anchor.html') Args() { }
+
+#
+# Test static paths vs. captures
+#
+
+sub apan : Chained('/') CaptureArgs(0) PathPrefix { }
+sub korv : Chained('apan') CaptureArgs(0) PathPart('') { }
+sub wurst : Chained('apan') CaptureArgs(1) PathPart('') { }
+sub static_end : Chained('korv') Args(0) { }
+sub capture_end : Chained('wurst') Args(0) PathPart('') { }
+
+sub end :Private {
+ my ($self, $c) = @_;
+ return if $c->stash->{no_end};
+ my $out = join('; ', map { join(', ', @$_) }
+ ($c->req->captures, $c->req->args));
+ $c->res->body($out);
+}
+
+1;
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Chained.pm
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Default.pm
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Default.pm (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Default.pm 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,11 @@
+package TestApp::Controller::Action::Default;
+
+use strict;
+use base 'TestApp::Controller::Action';
+
+sub default : Private {
+ my ( $self, $c ) = @_;
+ $c->forward('TestApp::View::Dump::Request');
+}
+
+1;
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Default.pm
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Detach.pm
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Detach.pm (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Detach.pm 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,45 @@
+package TestApp::Controller::Action::Detach;
+
+use strict;
+use base 'TestApp::Controller::Action';
+
+sub one : Local {
+ my ( $self, $c ) = @_;
+ $c->detach('two');
+ $c->forward('error');
+}
+
+sub two : Private {
+ my ( $self, $c ) = @_;
+ $c->forward('TestApp::View::Dump::Request');
+}
+
+sub error : Local {
+ my ( $self, $c ) = @_;
+ $c->res->output('error');
+}
+
+sub path : Local {
+ my ( $self, $c ) = @_;
+ $c->detach('/action/detach/two');
+ $c->forward('error');
+}
+
+sub with_args : Local {
+ my ( $self, $c, $orig ) = @_;
+ $c->detach( 'args', [qq/new/] );
+}
+
+sub with_method_and_args : Local {
+ my ( $self, $c, $orig ) = @_;
+ $c->detach( qw/TestApp::Controller::Action::Detach args/, [qq/new/] );
+}
+
+sub args : Local {
+ my ( $self, $c, $val ) = @_;
+ die "Expected argument 'new', got '$val'" unless $val eq 'new';
+ die "passed argument does not match args" unless $val eq $c->req->args->[0];
+ $c->res->body( $c->req->args->[0] );
+}
+
+1;
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Detach.pm
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/End.pm
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/End.pm (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/End.pm 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,15 @@
+package TestApp::Controller::Action::End;
+
+use strict;
+use base 'TestApp::Controller::Action';
+
+sub end : Private {
+ my ( $self, $c ) = @_;
+}
+
+sub default : Private {
+ my ( $self, $c ) = @_;
+ $c->forward('TestApp::View::Dump::Request');
+}
+
+1;
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/End.pm
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Forward.pm
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Forward.pm (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Forward.pm 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,93 @@
+package TestApp::Controller::Action::Forward;
+
+use strict;
+use base 'TestApp::Controller::Action';
+
+sub one : Local {
+ my ( $self, $c ) = @_;
+ $c->forward('two');
+}
+
+sub two : Private {
+ my ( $self, $c ) = @_;
+ $c->forward('three');
+}
+
+sub three : Local {
+ my ( $self, $c ) = @_;
+ $c->forward( $self, 'four' );
+}
+
+sub four : Private {
+ my ( $self, $c ) = @_;
+ $c->forward('/action/forward/five');
+}
+
+sub five : Local {
+ my ( $self, $c ) = @_;
+ $c->forward('View::Dump::Request');
+}
+
+sub jojo : Local {
+ my ( $self, $c ) = @_;
+ $c->forward('one');
+ $c->forward( $c->controller('Action::Forward'), 'three' );
+}
+
+sub inheritance : Local {
+ my ( $self, $c ) = @_;
+ $c->forward('/action/inheritance/a/b/default');
+ $c->forward('five');
+}
+
+sub global : Local {
+ my ( $self, $c ) = @_;
+ $c->forward('/global_action');
+}
+
+sub with_args : Local {
+ my ( $self, $c, $orig ) = @_;
+ $c->forward( 'args', [qq/new/] );
+ $c->res->body( $c->req->args->[0] );
+}
+
+sub with_method_and_args : Local {
+ my ( $self, $c, $orig ) = @_;
+ $c->forward( qw/TestApp::Controller::Action::Forward args/, [qq/new/] );
+ $c->res->body( $c->req->args->[0] );
+}
+
+sub args : Local {
+ my ( $self, $c, $val ) = @_;
+ die "Expected argument 'new', got '$val'" unless $val eq 'new';
+ die "passed argument does not match args" unless $val eq $c->req->args->[0];
+}
+
+sub args_embed_relative : Local {
+ my ( $self, $c ) = @_;
+ $c->forward('embed/ok');
+}
+
+sub args_embed_absolute : Local {
+ my ( $self, $c ) = @_;
+ $c->forward('/action/forward/embed/ok');
+}
+
+sub embed : Local {
+ my ( $self, $c, $ok ) = @_;
+
+ $ok ||= 'not ok';
+ $c->res->body($ok);
+}
+
+sub class_forward_test_action : Local {
+ my ( $self, $c ) = @_;
+ $c->forward(qw/TestApp class_forward_test_method/);
+}
+
+sub forward_to_uri_check : Local {
+ my ( $self, $c ) = @_;
+ $c->forward( 'Action::ForwardTo', 'uri_check' );
+}
+
+1;
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Forward.pm
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/ForwardTo.pm
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/ForwardTo.pm (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/ForwardTo.pm 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,11 @@
+package TestApp::Controller::Action::ForwardTo;
+
+use strict;
+use base 'TestApp::Controller::Action';
+
+sub uri_check : Private {
+ my ( $self, $c ) = @_;
+ $c->res->body( $c->uri_for('foo/bar')->path );
+}
+
+1;
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/ForwardTo.pm
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Global.pm
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Global.pm (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Global.pm 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,21 @@
+package TestApp::Controller::Action::Global;
+
+use strict;
+use base 'TestApp::Controller::Action';
+
+sub action_global_one : Action Absolute {
+ my ( $self, $c ) = @_;
+ $c->forward('TestApp::View::Dump::Request');
+}
+
+sub action_global_two : Action Global {
+ my ( $self, $c ) = @_;
+ $c->forward('TestApp::View::Dump::Request');
+}
+
+sub action_global_three : Action Path('/action_global_three') {
+ my ( $self, $c ) = @_;
+ $c->forward('TestApp::View::Dump::Request');
+}
+
+1;
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Global.pm
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Go.pm
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Go.pm (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Go.pm 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,102 @@
+package TestApp::Controller::Action::Go;
+
+use strict;
+use base 'TestApp::Controller::Action';
+
+sub one : Local {
+ my ( $self, $c ) = @_;
+ $c->go('two');
+}
+
+sub two : Private {
+ my ( $self, $c ) = @_;
+ $c->go('three');
+}
+
+sub three : Local {
+ my ( $self, $c ) = @_;
+ $c->go( $self, 'four' );
+}
+
+sub four : Private {
+ my ( $self, $c ) = @_;
+ $c->go('/action/go/five');
+}
+
+sub five : Local {
+ my ( $self, $c ) = @_;
+ $c->forward('View::Dump::Request');
+}
+
+sub inheritance : Local {
+ my ( $self, $c ) = @_;
+ $c->go('/action/inheritance/a/b/default');
+}
+
+sub global : Local {
+ my ( $self, $c ) = @_;
+ $c->go('/global_action');
+}
+
+sub with_args : Local {
+ my ( $self, $c, $arg ) = @_;
+ $c->go( 'args', [$arg] );
+}
+
+sub with_method_and_args : Local {
+ my ( $self, $c, $arg ) = @_;
+ $c->go( qw/TestApp::Controller::Action::Go args/, [$arg] );
+}
+
+sub args : Local {
+ my ( $self, $c, $val ) = @_;
+ die "passed argument does not match args" unless $val eq $c->req->args->[0];
+ $c->res->body($val);
+}
+
+sub go_die : Local {
+ my ( $self, $c, $val ) = @_;
+ eval { $c->go( 'args', [qq/new/] ) };
+ $c->res->body( $@ ? $@ : "go() did not die" );
+ die $Catalyst::GO;
+}
+
+sub go_chained : Local {
+ my ( $self, $c, $val ) = @_;
+ $c->go('/action/chained/foo/spoon',[1]);
+}
+
+sub view : Local {
+ my ( $self, $c, $val ) = @_;
+ eval { $c->go('View::Dump') };
+ $c->res->body( $@ ? $@ : "go() did not die" );
+}
+
+sub model : Local {
+ my ( $self, $c, $val ) = @_;
+ eval { $c->go('Model::Foo') };
+ $c->res->body( $@ ? $@ : "go() did not die" );
+}
+
+sub args_embed_relative : Local {
+ my ( $self, $c ) = @_;
+ $c->go('embed/ok');
+}
+
+sub args_embed_absolute : Local {
+ my ( $self, $c ) = @_;
+ $c->go('/action/go/embed/ok');
+}
+
+sub embed : Local {
+ my ( $self, $c, $ok ) = @_;
+ $ok ||= 'not ok';
+ $c->res->body($ok);
+}
+
+sub class_go_test_action : Local {
+ my ( $self, $c ) = @_;
+ $c->go(qw/TestApp class_go_test_method/);
+}
+
+1;
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Go.pm
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Index.pm
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Index.pm (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Index.pm 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,11 @@
+package TestApp::Controller::Action::Index;
+
+use strict;
+use base 'TestApp::Controller::Action';
+
+sub index : Private {
+ my ( $self, $c ) = @_;
+ $c->res->body( 'Action-Index index' );
+}
+
+1;
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Index.pm
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Inheritance.pm
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Inheritance.pm (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Inheritance.pm 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,74 @@
+package TestApp::Controller::Action::Inheritance;
+
+use strict;
+use base 'TestApp::Controller::Action';
+
+sub auto : Private {
+ my ( $self, $c ) = @_;
+ return 1;
+}
+
+sub begin : Private {
+ my ( $self, $c ) = @_;
+ $self->SUPER::begin($c);
+}
+
+sub default : Private {
+ my ( $self, $c ) = @_;
+ $c->forward('TestApp::View::Dump::Request');
+}
+
+sub end : Private {
+ my ( $self, $c ) = @_;
+}
+
+package TestApp::Controller::Action::Inheritance::A;
+
+use strict;
+use base 'TestApp::Controller::Action';
+
+sub auto : Private {
+ my ( $self, $c ) = @_;
+ return 1;
+}
+
+sub begin : Private {
+ my ( $self, $c ) = @_;
+ $self->SUPER::begin($c);
+}
+
+sub default : Private {
+ my ( $self, $c ) = @_;
+ $c->forward('TestApp::View::Dump::Request');
+}
+
+sub end : Private {
+ my ( $self, $c ) = @_;
+}
+
+package TestApp::Controller::Action::Inheritance::A::B;
+
+use strict;
+use base 'TestApp::Controller::Action';
+
+sub auto : Private {
+ my ( $self, $c ) = @_;
+ return 1;
+}
+
+sub begin : Private {
+ my ( $self, $c ) = @_;
+ $self->SUPER::begin($c);
+}
+
+sub default : Private {
+ my ( $self, $c ) = @_;
+ $c->forward('TestApp::View::Dump::Request');
+}
+
+sub end : Private {
+ my ( $self, $c ) = @_;
+}
+
+1;
+
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Inheritance.pm
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Local.pm
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Local.pm (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Local.pm 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,26 @@
+package TestApp::Controller::Action::Local;
+
+use strict;
+use base 'TestApp::Controller::Action';
+
+sub one : Action Relative {
+ my ( $self, $c ) = @_;
+ $c->forward('TestApp::View::Dump::Request');
+}
+
+sub two : Action Local Args(2) {
+ my ( $self, $c ) = @_;
+ $c->forward('TestApp::View::Dump::Request');
+}
+
+sub three : Action Path('three') {
+ my ( $self, $c ) = @_;
+ $c->forward('TestApp::View::Dump::Request');
+}
+
+sub four : Action Path('four/five/six') {
+ my ( $self, $c ) = @_;
+ $c->forward('TestApp::View::Dump::Request');
+}
+
+1;
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Local.pm
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Path.pm
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Path.pm (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Path.pm 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,38 @@
+package TestApp::Controller::Action::Path;
+
+use strict;
+use base 'TestApp::Controller::Action';
+
+__PACKAGE__->config(
+ actions => {
+ 'one' => { 'Path' => [ 'a path with spaces' ] },
+ 'two' => { 'Path' => "åäö" },
+ },
+);
+
+sub one : Action Path("this_will_be_overriden") {
+ my ( $self, $c ) = @_;
+ $c->forward('TestApp::View::Dump::Request');
+}
+
+sub two : Action {
+ my ( $self, $c ) = @_;
+ $c->forward('TestApp::View::Dump::Request');
+}
+
+sub three :Path {
+ my ( $self, $c ) = @_;
+ $c->forward('TestApp::View::Dump::Request');
+}
+
+sub four : Path( 'spaces_near_parens_singleq' ) {
+ my ( $self, $c ) = @_;
+ $c->forward('TestApp::View::Dump::Request');
+}
+
+sub five : Path( "spaces_near_parens_doubleq" ) {
+ my ( $self, $c ) = @_;
+ $c->forward('TestApp::View::Dump::Request');
+}
+
+1;
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Path.pm
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Private.pm
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Private.pm (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Private.pm 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,36 @@
+package TestApp::Controller::Action::Private;
+
+use strict;
+use base 'TestApp::Controller::Action';
+
+sub default : Private {
+ my ( $self, $c ) = @_;
+ $c->res->output('access denied');
+}
+
+sub one : Private {
+ my ( $self, $c ) = @_;
+ $c->res->output('access allowed');
+}
+
+sub two : Private Relative {
+ my ( $self, $c ) = @_;
+ $c->res->output('access allowed');
+}
+
+sub three : Private Absolute {
+ my ( $self, $c ) = @_;
+ $c->res->output('access allowed');
+}
+
+sub four : Private Path('/action/private/four') {
+ my ( $self, $c ) = @_;
+ $c->res->output('access allowed');
+}
+
+sub five : Private Path('five') {
+ my ( $self, $c ) = @_;
+ $c->res->output('access allowed');
+}
+
+1;
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Private.pm
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Regexp.pm
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Regexp.pm (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Regexp.pm 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,21 @@
+package TestApp::Controller::Action::Regexp;
+
+use strict;
+use base 'TestApp::Controller::Action';
+
+sub one : Action Regex('^action/regexp/(\w+)/(\d+)$') {
+ my ( $self, $c ) = @_;
+ $c->forward('TestApp::View::Dump::Request');
+}
+
+sub two : Action LocalRegexp('^(\d+)/(\w+)$') {
+ my ( $self, $c ) = @_;
+ $c->forward('TestApp::View::Dump::Request');
+}
+
+sub three : Action LocalRegex('^(mandatory)(/optional)?$'){
+ my ( $self, $c ) = @_;
+ $c->forward('TestApp::View::Dump::Request');
+}
+
+1;
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Regexp.pm
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Streaming.pm
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Streaming.pm (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Streaming.pm 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,30 @@
+package TestApp::Controller::Action::Streaming;
+
+use strict;
+use base 'TestApp::Controller::Action';
+
+sub streaming : Global {
+ my ( $self, $c ) = @_;
+ for my $line ( split "\n", <<'EOF' ) {
+foo
+bar
+baz
+EOF
+ $c->res->write("$line\n");
+ }
+}
+
+sub body : Local {
+ my ( $self, $c ) = @_;
+
+ my $file = "$FindBin::Bin/../01use.t";
+ my $fh = IO::File->new( $file, 'r' );
+ if ( defined $fh ) {
+ $c->res->body( $fh );
+ }
+ else {
+ $c->res->body( "Unable to read $file" );
+ }
+}
+
+1;
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Streaming.pm
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/TestMultipath.pm
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/TestMultipath.pm (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/TestMultipath.pm 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,21 @@
+package TestApp::Controller::Action::TestMultipath;
+
+use strict;
+use base 'TestApp::Controller::Action';
+
+__PACKAGE__->config(
+ namespace => 'action/multipath'
+);
+
+sub multipath : Local : Global : Path('/multipath1') : Path('multipath2') {
+ my ( $self, $c ) = @_;
+ for my $line ( split "\n", <<'EOF' ) {
+foo
+bar
+baz
+EOF
+ $c->res->write("$line\n");
+ }
+}
+
+1;
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/TestMultipath.pm
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/TestRelative.pm
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/TestRelative.pm (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/TestRelative.pm 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,40 @@
+package TestApp::Controller::Action::TestRelative;
+
+use strict;
+use base 'TestApp::Controller::Action';
+
+__PACKAGE__->config(
+ path => 'action/relative'
+);
+
+sub relative : Local {
+ my ( $self, $c ) = @_;
+ $c->forward('/action/forward/one');
+}
+
+sub relative_two : Local {
+ my ( $self, $c ) = @_;
+ $c->forward( 'TestApp::Controller::Action::Forward', 'one' );
+}
+
+sub relative_go : Local {
+ my ( $self, $c ) = @_;
+ $c->go('/action/go/one');
+}
+
+sub relative_go_two : Local {
+ my ( $self, $c ) = @_;
+ $c->go( 'TestApp::Controller::Action::Go', 'one' );
+}
+
+sub relative_visit : Local {
+ my ( $self, $c ) = @_;
+ $c->visit('/action/visit/one');
+}
+
+sub relative_visit_two : Local {
+ my ( $self, $c ) = @_;
+ $c->visit( 'TestApp::Controller::Action::Visit', 'one' );
+}
+
+1;
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/TestRelative.pm
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Visit.pm
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Visit.pm (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Visit.pm 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,101 @@
+package TestApp::Controller::Action::Visit;
+
+use strict;
+use base 'TestApp::Controller::Action';
+
+sub one : Local {
+ my ( $self, $c ) = @_;
+ $c->visit('two');
+}
+
+sub two : Private {
+ my ( $self, $c ) = @_;
+ $c->visit('three');
+}
+
+sub three : Local {
+ my ( $self, $c ) = @_;
+ $c->visit( $self, 'four' );
+}
+
+sub four : Private {
+ my ( $self, $c ) = @_;
+ $c->visit('/action/visit/five');
+}
+
+sub five : Local {
+ my ( $self, $c ) = @_;
+ $c->forward('View::Dump::Request');
+}
+
+sub inheritance : Local {
+ my ( $self, $c ) = @_;
+ $c->visit('/action/inheritance/a/b/default');
+}
+
+sub global : Local {
+ my ( $self, $c ) = @_;
+ $c->visit('/global_action');
+}
+
+sub with_args : Local {
+ my ( $self, $c, $arg ) = @_;
+ $c->visit( 'args', [$arg] );
+}
+
+sub with_method_and_args : Local {
+ my ( $self, $c, $arg ) = @_;
+ $c->visit( qw/TestApp::Controller::Action::Visit args/, [$arg] );
+}
+
+sub args : Local {
+ my ( $self, $c, $val ) = @_;
+ die "passed argument does not match args" unless $val eq $c->req->args->[0];
+ $c->res->body($val);
+}
+
+sub visit_die : Local {
+ my ( $self, $c, $val ) = @_;
+ eval { $c->visit( 'args', [qq/new/] ) };
+ $c->res->body( $@ ? $@ : "visit() doesn't die" );
+}
+
+sub visit_chained : Local {
+ my ( $self, $c, $val ) = @_;
+ $c->visit('/action/chained/foo/spoon',[1]);
+}
+
+sub view : Local {
+ my ( $self, $c, $val ) = @_;
+ eval { $c->visit('View::Dump') };
+ $c->res->body( $@ ? $@ : "visit() did not die" );
+}
+
+sub model : Local {
+ my ( $self, $c, $val ) = @_;
+ eval { $c->visit('Model::Foo') };
+ $c->res->body( $@ ? $@ : "visit() did not die" );
+}
+
+sub args_embed_relative : Local {
+ my ( $self, $c ) = @_;
+ $c->visit('embed/ok');
+}
+
+sub args_embed_absolute : Local {
+ my ( $self, $c ) = @_;
+ $c->visit('/action/visit/embed/ok');
+}
+
+sub embed : Local {
+ my ( $self, $c, $ok ) = @_;
+ $ok ||= 'not ok';
+ $c->res->body($ok);
+}
+
+sub class_visit_test_action : Local {
+ my ( $self, $c ) = @_;
+ $c->visit(qw/TestApp class_visit_test_method/);
+}
+
+1;
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action/Visit.pm
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action.pm
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action.pm (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action.pm 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,18 @@
+package TestApp::Controller::Action;
+
+use strict;
+use base 'Catalyst::Controller';
+
+sub begin : Private {
+ my ( $self, $c ) = @_;
+ $c->res->header( 'X-Test-Class' => ref($self) );
+ $c->response->content_type('text/plain; charset=utf-8');
+}
+
+sub default : Private {
+ my ( $self, $c ) = @_;
+ $c->res->output("Error - TestApp::Controller::Action\n");
+ $c->res->status(404);
+}
+
+1;
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Action.pm
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Args.pm
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Args.pm (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Args.pm 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,16 @@
+package TestApp::Controller::Args;
+
+use strict;
+use base 'Catalyst::Base';
+
+sub args :Local {
+ my ( $self, $c ) = @_;
+ $c->res->body( join('',@{$c->req->args}) );
+}
+
+sub params :Local {
+ my ( $self, $c ) = splice @_, 0, 2;
+ $c->res->body( join('', at _) );
+}
+
+1;
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Args.pm
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Dump.pm
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Dump.pm (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Dump.pm 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,32 @@
+package TestApp::Controller::Dump;
+
+use strict;
+use base 'Catalyst::Base';
+
+sub default : Action Private {
+ my ( $self, $c ) = @_;
+ $c->forward('TestApp::View::Dump');
+}
+
+sub env : Action Relative {
+ my ( $self, $c ) = @_;
+ $c->stash( env => \%ENV );
+ $c->forward('TestApp::View::Dump');
+}
+
+sub parameters : Action Relative {
+ my ( $self, $c ) = @_;
+ $c->forward('TestApp::View::Dump::Parameters');
+}
+
+sub request : Action Relative {
+ my ( $self, $c ) = @_;
+ $c->forward('TestApp::View::Dump::Request');
+}
+
+sub response : Action Relative {
+ my ( $self, $c ) = @_;
+ $c->forward('TestApp::View::Dump::Response');
+}
+
+1;
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Dump.pm
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Engine/Request/URI.pm
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Engine/Request/URI.pm (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Engine/Request/URI.pm 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,102 @@
+package TestApp::Controller::Engine::Request::URI;
+
+use strict;
+use base 'Catalyst::Base';
+
+sub default : Private {
+ my ( $self, $c ) = @_;
+
+ $c->forward('TestApp::View::Dump::Request');
+}
+
+sub change_path : Local {
+ my ( $self, $c ) = @_;
+
+ # change the path
+ $c->req->path( '/my/app/lives/here' );
+
+ $c->forward('TestApp::View::Dump::Request');
+}
+
+sub change_base : Local {
+ my ( $self, $c ) = @_;
+
+ # change the base and uri paths
+ $c->req->base->path( '/new/location' );
+ $c->req->uri->path( '/new/location/engine/request/uri/change_base' );
+
+ $c->forward('TestApp::View::Dump::Request');
+}
+
+sub uri_with : Local {
+ my ( $self, $c ) = @_;
+
+ # change the current uri
+ my $uri = $c->req->uri_with( { b => 1 } );
+ my %query = $uri->query_form;
+
+ $c->res->header( 'X-Catalyst-Param-a' => $query{ a } );
+ $c->res->header( 'X-Catalyst-Param-b' => $query{ b } );
+
+ $c->forward('TestApp::View::Dump::Request');
+}
+
+sub uri_with_object : Local {
+ my ( $self, $c ) = @_;
+
+ my $uri = $c->req->uri_with( { a => $c->req->base } );
+ my %query = $uri->query_form;
+
+ $c->res->header( 'X-Catalyst-Param-a' => $query{ a } );
+
+ $c->forward('TestApp::View::Dump::Request');
+}
+
+sub uri_with_utf8 : Local {
+ my ( $self, $c ) = @_;
+
+ # change the current uri
+ my $uri = $c->req->uri_with( { unicode => "\x{2620}" } );
+
+ $c->res->header( 'X-Catalyst-uri-with' => "$uri" );
+
+ $c->forward('TestApp::View::Dump::Request');
+}
+
+sub uri_with_undef : Local {
+ my ( $self, $c ) = @_;
+
+ my $warnings = 0;
+ local $SIG{__WARN__} = sub { $warnings++ };
+
+ # change the current uri
+ my $uri = $c->req->uri_with( { foo => undef } );
+
+ $c->res->header( 'X-Catalyst-warnings' => $warnings );
+
+ $c->forward('TestApp::View::Dump::Request');
+}
+
+sub uri_with_undef_only : Local {
+ my ( $self, $c ) = @_;
+
+ my $uri = $c->req->uri_with( { a => undef } );
+
+ $c->res->header( 'X-Catalyst-uri-with' => "$uri" );
+ $c->forward('TestApp::View::Dump::Request');
+}
+
+sub uri_with_undef_ignore : Local {
+ my ( $self, $c ) = @_;
+
+ my $uri = $c->req->uri_with( { a => 1, b => undef } );
+
+ my %query = $uri->query_form;
+ $c->res->header( 'X-Catalyst-uri-with' => "$uri" );
+ $c->res->header( 'X-Catalyst-Param-a' => $query{ a } );
+ $c->res->header( 'X-Catalyst-Param-b' => $query{ b } );
+ $c->res->header( 'X-Catalyst-Param-c' => $query{ c } );
+ $c->forward('TestApp::View::Dump::Request');
+}
+
+1;
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Engine/Request/URI.pm
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Engine/Request/Uploads.pm
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Engine/Request/Uploads.pm (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Engine/Request/Uploads.pm 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,12 @@
+package TestApp::Controller::Engine::Request::Uploads;
+
+use strict;
+use base 'Catalyst::Base';
+
+sub slurp : Relative {
+ my ( $self, $c ) = @_;
+ $c->response->content_type('text/plain; charset=utf-8');
+ $c->response->output( $c->request->upload('slurp')->slurp );
+}
+
+1;
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Engine/Request/Uploads.pm
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Engine/Response/Cookies.pm
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Engine/Response/Cookies.pm (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Engine/Response/Cookies.pm 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,35 @@
+package TestApp::Controller::Engine::Response::Cookies;
+
+use strict;
+use base 'Catalyst::Base';
+
+sub one : Local {
+ my ( $self, $c ) = @_;
+ $c->res->cookies->{Catalyst} = { value => 'Cool', path => '/bah' };
+ $c->res->cookies->{Cool} = { value => 'Catalyst', path => '/' };
+ $c->forward('TestApp::View::Dump::Request');
+}
+
+sub two : Local {
+ my ( $self, $c ) = @_;
+ $c->res->cookies->{Catalyst} = { value => 'Cool', path => '/bah' };
+ $c->res->cookies->{Cool} = { value => 'Catalyst', path => '/' };
+ $c->res->redirect('http://www.google.com/');
+}
+
+sub three : Local {
+ my ( $self, $c ) = @_;
+
+ $c->res->cookies->{object} = CGI::Simple::Cookie->new(
+ -name => "this_is_the_real_name",
+ -value => [qw/foo bar/],
+ );
+
+ $c->res->cookies->{hash} = {
+ value => [qw/a b c/],
+ };
+
+ $c->forward('TestApp::View::Dump::Request');
+}
+
+1;
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Engine/Response/Cookies.pm
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Engine/Response/Errors.pm
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Engine/Response/Errors.pm (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Engine/Response/Errors.pm 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,23 @@
+package TestApp::Controller::Engine::Response::Errors;
+
+use strict;
+use base 'Catalyst::Base';
+
+sub one : Relative {
+ my ( $self, $c ) = @_;
+ my $a = 0;
+ my $b = 0;
+ my $t = $a / $b;
+}
+
+sub two : Relative {
+ my ( $self, $c ) = @_;
+ $c->forward('/non/existing/path');
+}
+
+sub three : Relative {
+ my ( $self, $c ) = @_;
+ die("I'm going to die!\n");
+}
+
+1;
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Engine/Response/Errors.pm
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Engine/Response/Headers.pm
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Engine/Response/Headers.pm (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Engine/Response/Headers.pm 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,14 @@
+package TestApp::Controller::Engine::Response::Headers;
+
+use strict;
+use base 'Catalyst::Base';
+
+sub one : Relative {
+ my ( $self, $c ) = @_;
+ $c->res->header( 'X-Header-Catalyst' => 'Cool' );
+ $c->res->header( 'X-Header-Cool' => 'Catalyst' );
+ $c->res->header( 'X-Header-Numbers' => join ', ', 1 .. 10 );
+ $c->forward('TestApp::View::Dump::Request');
+}
+
+1;
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Engine/Response/Headers.pm
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Engine/Response/Large.pm
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Engine/Response/Large.pm (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Engine/Response/Large.pm 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,16 @@
+package TestApp::Controller::Engine::Response::Large;
+
+use strict;
+use base 'Catalyst::Base';
+
+sub one : Relative {
+ my ( $self, $c ) = @_;
+ $c->res->output( 'x' x (100 * 1024) );
+}
+
+sub two : Relative {
+ my ( $self, $c ) = @_;
+ $c->res->output( 'y' x (1024 * 1024) );
+}
+
+1;
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Engine/Response/Large.pm
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Engine/Response/Print.pm
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Engine/Response/Print.pm (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Engine/Response/Print.pm 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,25 @@
+package TestApp::Controller::Engine::Response::Print;
+
+use strict;
+use base 'Catalyst::Base';
+
+sub one :Relative {
+ my ( $self, $c ) = @_;
+
+ $c->res->print("foo");
+}
+
+sub two :Relative {
+ my ( $self, $c ) = @_;
+
+ $c->res->print(qw/foo bar/);
+}
+
+sub three :Relative {
+ my ( $self, $c ) = @_;
+
+ local $, = ',';
+ $c->res->print(qw/foo bar baz/);
+}
+
+1;
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Engine/Response/Print.pm
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Engine/Response/Redirect.pm
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Engine/Response/Redirect.pm (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Engine/Response/Redirect.pm 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,29 @@
+package TestApp::Controller::Engine::Response::Redirect;
+
+use strict;
+use base 'Catalyst::Base';
+
+sub one : Relative {
+ my ( $self, $c ) = @_;
+ $c->response->redirect('/test/writing/is/boring');
+}
+
+sub two : Relative {
+ my ( $self, $c ) = @_;
+ $c->response->redirect('http://www.google.com/');
+}
+
+sub three : Relative {
+ my ( $self, $c ) = @_;
+ $c->response->redirect('http://www.google.com/');
+ $c->response->status(301); # Moved Permanently
+}
+
+sub four : Relative {
+ my ( $self, $c ) = @_;
+ $c->response->redirect('http://www.google.com/');
+ $c->response->status(307); # Temporary Redirect
+}
+
+1;
+
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Engine/Response/Redirect.pm
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Engine/Response/Status.pm
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Engine/Response/Status.pm (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Engine/Response/Status.pm 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,42 @@
+package TestApp::Controller::Engine::Response::Status;
+
+use strict;
+use base 'Catalyst::Base';
+
+sub begin : Private {
+ my ( $self, $c ) = @_;
+ $c->response->content_type('text/plain');
+ return 1;
+}
+
+sub s200 : Relative {
+ my ( $self, $c ) = @_;
+ $c->res->status(200);
+ $c->res->output("200 OK\n");
+}
+
+sub s400 : Relative {
+ my ( $self, $c ) = @_;
+ $c->res->status(400);
+ $c->res->output("400 Bad Request\n");
+}
+
+sub s403 : Relative {
+ my ( $self, $c ) = @_;
+ $c->res->status(403);
+ $c->res->output("403 Forbidden\n");
+}
+
+sub s404 : Relative {
+ my ( $self, $c ) = @_;
+ $c->res->status(404);
+ $c->res->output("404 Not Found\n");
+}
+
+sub s500 : Relative {
+ my ( $self, $c ) = @_;
+ $c->res->status(500);
+ $c->res->output("500 Internal Server Error\n");
+}
+
+1;
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Engine/Response/Status.pm
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Fork.pm
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Fork.pm (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Fork.pm 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,60 @@
+#!/usr/bin/perl
+# Fork.pm
+# Copyright (c) 2006 Jonathan Rockway <jrockway at cpan.org>
+
+package TestApp::Controller::Fork;
+
+use strict;
+use warnings;
+use base 'Catalyst::Controller';
+use YAML;
+
+sub system : Local {
+ my ($self, $c, $ls) = @_;
+ my ($result, $code) = (undef, 1);
+
+ if(!-e $ls || !-x _){
+ $result = 'skip';
+ }
+ else {
+ $result = system($ls, $ls, $ls);
+ $result = $! if $result != 0;
+ }
+
+ $c->response->body(Dump({result => $result}));
+}
+
+sub backticks : Local {
+ my ($self, $c, $ls) = @_;
+ my ($result, $code) = (undef, 1);
+
+ if(!-e $ls || !-x _){
+ $result = 'skip';
+ $code = 0;
+ }
+ else {
+ $result = `$ls $ls $ls` || $!;
+ $code = $?;
+ }
+
+ $c->response->body(Dump({result => $result, code => $code}));
+}
+
+sub fork : Local {
+ my ($self, $c) = @_;
+ my $pid;
+ my $x = 0;
+
+ if($pid = fork()){
+ $x = "ok";
+ }
+ else {
+ exit(0);
+ }
+
+ waitpid $pid,0 or die;
+
+ $c->response->body(Dump({pid => $pid, result => $x}));
+}
+
+1;
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Fork.pm
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Index.pm
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Index.pm (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Index.pm 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,11 @@
+package TestApp::Controller::Index;
+
+use strict;
+use base 'Catalyst::Base';
+
+sub index : Private {
+ my ( $self, $c ) = @_;
+ $c->res->body( 'Index index' );
+}
+
+1;
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Index.pm
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Priorities/MultiMethod.pm
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Priorities/MultiMethod.pm (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Priorities/MultiMethod.pm 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,19 @@
+package TestApp::Controller::Priorities::MultiMethod;
+
+use strict;
+use warnings;
+use base qw/Catalyst::Controller/;
+
+sub auto :Private {
+ my ($self, $c) = @_;
+ $c->res->body(join(' ', $c->action->name, @{$c->req->args}));
+ return 1;
+}
+
+sub zero :Path :Args(0) { }
+
+sub one :Path :Args(1) { }
+
+sub two :Path :Args(2) { }
+
+1;
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Priorities/MultiMethod.pm
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Priorities/loc_vs_index.pm
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Priorities/loc_vs_index.pm (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Priorities/loc_vs_index.pm 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,8 @@
+package TestApp::Controller::Priorities::loc_vs_index;
+
+use strict;
+use base 'Catalyst::Base';
+
+sub index :Private { $_[1]->res->body( 'index' ) }
+
+1;
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Priorities/loc_vs_index.pm
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Priorities/locre_vs_index.pm
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Priorities/locre_vs_index.pm (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Priorities/locre_vs_index.pm 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,8 @@
+package TestApp::Controller::Priorities::locre_vs_index;
+
+use strict;
+use base 'Catalyst::Base';
+
+sub index :Private { $_[1]->res->body( 'index' ) }
+
+1;
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Priorities/locre_vs_index.pm
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Priorities/path_vs_index.pm
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Priorities/path_vs_index.pm (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Priorities/path_vs_index.pm 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,8 @@
+package TestApp::Controller::Priorities::path_vs_index;
+
+use strict;
+use base 'Catalyst::Base';
+
+sub index :Private { $_[1]->res->body( 'index' ) }
+
+1;
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Priorities/path_vs_index.pm
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Priorities/re_vs_index.pm
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Priorities/re_vs_index.pm (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Priorities/re_vs_index.pm 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,8 @@
+package TestApp::Controller::Priorities::re_vs_index;
+
+use strict;
+use base 'Catalyst::Base';
+
+sub index :Private { $_[1]->res->body( 'index' ) }
+
+1;
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Priorities/re_vs_index.pm
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Priorities.pm
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Priorities.pm (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Priorities.pm 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,75 @@
+package TestApp::Controller::Priorities;
+
+use strict;
+use base 'Catalyst::Base';
+
+#
+# Regex vs. Local
+#
+
+sub re_vs_loc_re :Regex('/priorities/re_vs_loc') { $_[1]->res->body( 'regex' ) }
+sub re_vs_loc :Local { $_[1]->res->body( 'local' ) }
+
+#
+# Regex vs. LocalRegex
+#
+
+sub re_vs_locre_locre :LocalRegex('re_vs_(locre)') { $_[1]->res->body( 'local_regex' ) }
+sub re_vs_locre_re :Regex('/priorities/re_vs_locre') { $_[1]->res->body( 'regex' ) }
+
+#
+# Regex vs. Path
+#
+
+sub re_vs_path_path :Path('/priorities/re_vs_path') { $_[1]->res->body( 'path' ) }
+sub re_vs_path_re :Regex('/priorities/re_vs_path') { $_[1]->res->body( 'regex' ) }
+
+#
+# Local vs. LocalRegex
+#
+
+sub loc_vs_locre_locre :LocalRegex('loc_vs_locre') { $_[1]->res->body( 'local_regex' ) }
+sub loc_vs_locre :Local { $_[1]->res->body( 'local' ) }
+
+#
+# Local vs. Path (depends on definition order)
+#
+
+sub loc_vs_path1_loc :Path('/priorities/loc_vs_path1') { $_[1]->res->body( 'path' ) }
+sub loc_vs_path1 :Local { $_[1]->res->body( 'local' ) }
+
+sub loc_vs_path2 :Local { $_[1]->res->body( 'local' ) }
+sub loc_vs_path2_loc :Path('/priorities/loc_vs_path2') { $_[1]->res->body( 'path' ) }
+
+#
+# Path vs. LocalRegex
+#
+
+sub path_vs_locre_locre :LocalRegex('path_vs_(locre)') { $_[1]->res->body( 'local_regex' ) }
+sub path_vs_locre_path :Path('/priorities/path_vs_locre') { $_[1]->res->body( 'path' ) }
+
+#
+# Regex vs. index (has sub controller)
+#
+
+sub re_vs_idx :Regex('/priorities/re_vs_index') { $_[1]->res->body( 'regex' ) }
+
+#
+# Local vs. index (has sub controller)
+#
+
+sub loc_vs_index :Local { $_[1]->res->body( 'local' ) }
+
+#
+# LocalRegex vs. index (has sub controller)
+#
+
+sub locre_vs_idx :LocalRegex('locre_vs_index') { $_[1]->res->body( 'local_regex' ) }
+
+#
+# Path vs. index (has sub controller)
+#
+
+sub path_vs_idx :Path('/priorities/path_vs_index') { $_[1]->res->body( 'path' ) }
+
+1;
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Priorities.pm
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Root.pm
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Root.pm (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Root.pm 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,23 @@
+package TestApp::Controller::Root;
+
+use base 'Catalyst::Controller';
+
+__PACKAGE__->config->{namespace} = '';
+
+sub chain_root_index : Chained('/') PathPart('') Args(0) { }
+
+sub zero : Path('0') {
+ my ( $self, $c ) = @_;
+ $c->res->header( 'X-Test-Class' => ref($self) );
+ $c->response->content_type('text/plain; charset=utf-8');
+ $c->forward('TestApp::View::Dump::Request');
+}
+
+sub localregex : LocalRegex('^localregex$') {
+ my ( $self, $c ) = @_;
+ $c->res->header( 'X-Test-Class' => ref($self) );
+ $c->response->content_type('text/plain; charset=utf-8');
+ $c->forward('TestApp::View::Dump::Request');
+}
+
+1;
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Controller/Root.pm
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Model/Foo/Bar.pm
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Model/Foo/Bar.pm (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Model/Foo/Bar.pm 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,5 @@
+package TestApp::Model::Foo::Bar;
+
+sub model_foo_bar_method_from_foo_bar { "model_foo_bar_method_from_foo_bar" }
+
+1;
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Model/Foo/Bar.pm
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Model/Foo.pm
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Model/Foo.pm (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Model/Foo.pm 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,20 @@
+package TestApp::Model::Foo;
+
+use strict;
+use warnings;
+
+use base qw/ Catalyst::Model /;
+
+__PACKAGE__->config( 'quux' => 'chunkybacon' );
+
+sub model_foo_method { 1 }
+
+sub model_quux_method { shift->{quux} }
+
+package TestApp::Model::Foo::Bar;
+sub model_foo_bar_method_from_foo { 1 }
+
+package TestApp::Model::Foo;
+sub bar { "TestApp::Model::Foo::Bar" }
+
+1;
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Model/Foo.pm
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Plugin/FullyQualified.pm
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Plugin/FullyQualified.pm (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Plugin/FullyQualified.pm 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,13 @@
+package TestApp::Plugin::FullyQualified;
+
+use strict;
+
+sub fully_qualified {
+ my $c = shift;
+
+ $c->stash->{fully_qualified} = 1;
+
+ return $c;
+}
+
+1;
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/Plugin/FullyQualified.pm
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/View/Dump/Parameters.pm
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/View/Dump/Parameters.pm (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/View/Dump/Parameters.pm 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,11 @@
+package TestApp::View::Dump::Parameters;
+
+use strict;
+use base 'TestApp::View::Dump';
+
+sub process {
+ my ( $self, $c ) = @_;
+ return $self->SUPER::process( $c, $c->req->parameters );
+}
+
+1;
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/View/Dump/Parameters.pm
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/View/Dump/Request.pm
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/View/Dump/Request.pm (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/View/Dump/Request.pm 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,11 @@
+package TestApp::View::Dump::Request;
+
+use strict;
+use base qw[TestApp::View::Dump];
+
+sub process {
+ my ( $self, $c ) = @_;
+ return $self->SUPER::process( $c, $c->request );
+}
+
+1;
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/View/Dump/Request.pm
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/View/Dump/Response.pm
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/View/Dump/Response.pm (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/View/Dump/Response.pm 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,11 @@
+package TestApp::View::Dump::Response;
+
+use strict;
+use base qw[TestApp::View::Dump];
+
+sub process {
+ my ( $self, $c ) = @_;
+ return $self->SUPER::process( $c, $c->response );
+}
+
+1;
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/View/Dump/Response.pm
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/View/Dump.pm
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/View/Dump.pm (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/View/Dump.pm 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,57 @@
+package TestApp::View::Dump;
+
+use strict;
+use base 'Catalyst::View';
+
+use Data::Dumper ();
+use Scalar::Util qw(weaken);
+
+sub dump {
+ my ( $self, $reference ) = @_;
+
+ return unless $reference;
+
+ my $dumper = Data::Dumper->new( [$reference] );
+ $dumper->Indent(1);
+ $dumper->Purity(1);
+ $dumper->Useqq(0);
+ $dumper->Deepcopy(1);
+ $dumper->Quotekeys(0);
+ $dumper->Terse(1);
+
+ return $dumper->Dump;
+}
+
+sub process {
+ my ( $self, $c, $reference ) = @_;
+
+ # Force processing of on-demand data
+ $c->prepare_body;
+
+ # Remove context from reference if needed
+ my $context = delete $reference->{_context};
+
+ # Remove body from reference if needed
+ my $body = delete $reference->{_body};
+
+ if ( my $output =
+ $self->dump( $reference || $c->stash->{dump} || $c->stash ) )
+ {
+
+ $c->res->headers->content_type('text/plain');
+ $c->res->output($output);
+
+ # Repair context
+ $reference->{_context} = $context;
+ weaken( $reference->{_context} );
+
+ # Repair body
+ $reference->{_body} = $body;
+
+ return 1;
+ }
+
+ return 0;
+}
+
+1;
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp/View/Dump.pm
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp.pm
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp.pm (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp.pm 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,111 @@
+package TestApp;
+
+use strict;
+use Catalyst qw/
+ Test::Errors
+ Test::Headers
+ Test::Plugin
+ Test::Inline
+ +TestApp::Plugin::FullyQualified
+/;
+use Catalyst::Utils;
+
+our $VERSION = '0.01';
+
+TestApp->config( name => 'TestApp', root => '/some/dir' );
+
+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];
+ my $action = $_[1]->reverse;
+
+ my $method;
+
+ if ( $action =~ /->(\w+)$/ ) {
+ $method = $1;
+ }
+ elsif ( $action =~ /\/(\w+)$/ ) {
+ $method = $1;
+ }
+ elsif ( $action =~ /^(\w+)$/ ) {
+ $method = $action;
+ }
+
+ if ( $class && $method && $method !~ /^_/ ) {
+ my $executed = sprintf( "%s->%s", $class, $method );
+ my @executed = $c->response->headers->header('X-Catalyst-Executed');
+ push @executed, $executed;
+ $c->response->headers->header(
+ 'X-Catalyst-Executed' => join ', ',
+ @executed
+ );
+ }
+
+ return $c->SUPER::execute(@_);
+}
+
+# Replace the very large HTML error page with
+# useful info if something crashes during a test
+sub finalize_error {
+ my $c = shift;
+
+ $c->NEXT::finalize_error(@_);
+
+ $c->res->status(500);
+ $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 class_go_test_method :Private {
+ my ( $self, $c ) = @_;
+ $c->response->headers->header( 'X-Class-Go-Test-Method' => 1 );
+}
+
+sub class_visit_test_method :Private {
+ my ( $self, $c ) = @_;
+ $c->response->headers->header( 'X-Class-Visit-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' );
+}
+
+{
+ no warnings 'redefine';
+ sub Catalyst::Log::error { }
+}
+
+# Make sure we can load Inline plugins.
+
+package Catalyst::Plugin::Test::Inline;
+
+use strict;
+
+use base qw/Catalyst::Base Class::Data::Inheritable/;
+
+1;
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestApp.pm
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestAppChainedAbsolutePathPart/Controller/Foo.pm
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/lib/TestAppChainedAbsolutePathPart/Controller/Foo.pm (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/lib/TestAppChainedAbsolutePathPart/Controller/Foo.pm 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,10 @@
+package TestAppChainedAbsolutePathPart::Controller::Foo;
+
+use strict;
+use warnings;
+
+use base qw/Catalyst::Controller/;
+
+sub foo : Chained PathPart('/foo/bar') Args(1) { }
+
+1;
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestAppChainedAbsolutePathPart/Controller/Foo.pm
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestAppChainedAbsolutePathPart.pm
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/lib/TestAppChainedAbsolutePathPart.pm (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/lib/TestAppChainedAbsolutePathPart.pm 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,20 @@
+package TestAppChainedAbsolutePathPart;
+
+use strict;
+use Catalyst qw/
+ Test::Errors
+ Test::Headers
+/;
+use Catalyst::Utils;
+
+our $VERSION = '0.01';
+
+TestAppChainedAbsolutePathPart
+ ->config(
+ name => 'TestAppChainedAbsolutePathPart',
+ root => '/some/dir'
+ );
+
+TestAppChainedAbsolutePathPart->setup;
+
+1;
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestAppChainedAbsolutePathPart.pm
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestAppChainedRecursive/Controller/Foo.pm
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/lib/TestAppChainedRecursive/Controller/Foo.pm (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/lib/TestAppChainedRecursive/Controller/Foo.pm 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,11 @@
+package TestAppChainedRecursive::Controller::Foo;
+
+use strict;
+use warnings;
+
+use base qw/Catalyst::Controller/;
+
+sub foo : Chained('bar') CaptureArgs(1) { }
+sub bar : Chained('foo') CaptureArgs(1) { }
+
+1;
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestAppChainedRecursive/Controller/Foo.pm
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestAppChainedRecursive.pm
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/lib/TestAppChainedRecursive.pm (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/lib/TestAppChainedRecursive.pm 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,19 @@
+package TestAppChainedRecursive;
+
+use strict;
+use Catalyst qw/
+ Test::Errors
+ Test::Headers
+/;
+use Catalyst::Utils;
+
+our $VERSION = '0.01';
+
+TestAppChainedRecursive->config(
+ name => 'TestAppChainedRecursive',
+ root => '/some/dir'
+);
+
+TestAppChainedRecursive->setup;
+
+1;
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestAppChainedRecursive.pm
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestAppDoubleAutoBug.pm
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/lib/TestAppDoubleAutoBug.pm (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/lib/TestAppDoubleAutoBug.pm 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,59 @@
+use strict;
+use warnings;
+
+package TestAppDoubleAutoBug;
+
+use Catalyst qw/
+ Test::Errors
+ Test::Headers
+ Test::Plugin
+/;
+
+our $VERSION = '0.01';
+
+__PACKAGE__->config( name => 'TestAppDoubleAutoBug', root => '/some/dir' );
+
+__PACKAGE__->setup;
+
+sub execute {
+ my $c = shift;
+ my $class = ref( $c->component( $_[0] ) ) || $_[0];
+ my $action = $_[1]->reverse();
+
+ my $method;
+
+ if ( $action =~ /->(\w+)$/ ) {
+ $method = $1;
+ }
+ elsif ( $action =~ /\/(\w+)$/ ) {
+ $method = $1;
+ }
+ elsif ( $action =~ /^(\w+)$/ ) {
+ $method = $action;
+ }
+
+ if ( $class && $method && $method !~ /^_/ ) {
+ my $executed = sprintf( "%s->%s", $class, $method );
+ my @executed = $c->response->headers->header('X-Catalyst-Executed');
+ push @executed, $executed;
+ $c->response->headers->header(
+ 'X-Catalyst-Executed' => join ', ',
+ @executed
+ );
+ }
+
+ 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} );
+}
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestAppDoubleAutoBug.pm
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestAppOnDemand/Controller/Body.pm
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/lib/TestAppOnDemand/Controller/Body.pm (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/lib/TestAppOnDemand/Controller/Body.pm 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,29 @@
+package TestAppOnDemand::Controller::Body;
+
+use strict;
+use base 'Catalyst::Base';
+
+use Data::Dump ();
+
+sub params : Local {
+ my ( $self, $c ) = @_;
+
+ $c->res->body( Data::Dump::dump( $c->req->body_parameters ) );
+}
+
+sub read : Local {
+ my ( $self, $c ) = @_;
+
+ # read some data
+ my @chunks;
+
+ while ( my $data = $c->read( 10_000 ) ) {
+ push @chunks, $data;
+ }
+
+ $c->res->content_type( 'text/plain');
+
+ $c->res->body( join ( '|', map { length $_ } @chunks ) );
+}
+
+1;
\ No newline at end of file
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestAppOnDemand/Controller/Body.pm
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestAppOnDemand.pm
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/lib/TestAppOnDemand.pm (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/lib/TestAppOnDemand.pm 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,20 @@
+package TestAppOnDemand;
+
+use strict;
+use Catalyst qw/
+ Test::Errors
+ Test::Headers
+/;
+use Catalyst::Utils;
+
+our $VERSION = '0.01';
+
+__PACKAGE__->config(
+ name => __PACKAGE__,
+ root => '/some/dir',
+ parse_on_demand => 1,
+);
+
+__PACKAGE__->setup;
+
+1;
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestAppOnDemand.pm
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestAppPathBug.pm
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/lib/TestAppPathBug.pm (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/lib/TestAppPathBug.pm 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,19 @@
+use strict;
+use warnings;
+
+package TestAppPathBug;
+
+use Catalyst;
+
+our $VERSION = '0.01';
+
+__PACKAGE__->config( name => 'TestAppPathBug', root => '/some/dir' );
+
+__PACKAGE__->setup;
+
+sub foo : Path {
+ my ( $self, $c ) = @_;
+ $c->res->body( 'This is the foo method.' );
+}
+
+1;
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestAppPathBug.pm
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestAppStats.pm
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/lib/TestAppStats.pm (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/lib/TestAppStats.pm 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,31 @@
+use strict;
+use warnings;
+
+package TestAppStats;
+
+use Catalyst qw/
+ -Stats=1
+/;
+
+our $VERSION = '0.01';
+our @log_messages;
+
+__PACKAGE__->config( name => 'TestAppStats', root => '/some/dir' );
+
+__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, @_); }
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/lib/TestAppStats.pm
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/optional_httpengine-server.t
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/optional_httpengine-server.t (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/optional_httpengine-server.t 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,74 @@
+#!perl
+
+use strict;
+use warnings;
+
+use File::Copy;
+use File::Path;
+use FindBin;
+use IO::Socket;
+use Test::More;
+eval "use File::Copy::Recursive";
+
+plan skip_all => 'set TEST_HTTPENGINE to enable this test' unless $ENV{TEST_HTTPENGINE};
+plan skip_all => 'File::Copy::Recursive required' if $@;
+plan tests => 1;
+
+# clean up
+rmtree "$FindBin::Bin/../t/tmp" if -d "$FindBin::Bin/../t/tmp";
+
+# create a TestApp and copy the test libs into it
+mkdir "$FindBin::Bin/../t/tmp";
+chdir "$FindBin::Bin/../t/tmp";
+system "catalyst.pl TestApp";
+copy "$FindBin::Bin/../t/testapp_httpengine.pl", "$FindBin::Bin/../t/tmp/TestApp/script/testapp_httpengine.pl";
+chdir "$FindBin::Bin/..";
+File::Copy::Recursive::dircopy( 't/lib', 't/tmp/TestApp/lib' );
+
+# remove TestApp's tests
+rmtree 't/tmp/TestApp/t';
+
+# remove the Root controller
+unlink 't/tmp/TestApp/lib/TestApp/Controller/Root.pm';
+
+# spawn the standalone Prefork server
+my $port = 30000 + int rand(1 + 10000);
+my $pid = open my $server,
+ "perl -I$FindBin::Bin/../lib $FindBin::Bin/../t/tmp/TestApp/script/testapp_httpengine.pl -port $port 2>&1 |"
+ or die "Unable to spawn standalone HTTP::Engine server: $!";
+
+# wait for it to start
+print "Waiting for server to start...\n";
+while ( check_port( 'localhost', $port ) != 1 ) {
+ sleep 1;
+}
+
+# run the testsuite against the Prefork server
+$ENV{CATALYST_SERVER} = "http://localhost:$port";
+system( 'prove -r -Ilib/ t/aggregate/live_*' );
+
+# shut it down
+kill 'INT', $pid;
+close $server;
+
+# clean up
+#rmtree "$FindBin::Bin/../t/tmp" if -d "$FindBin::Bin/../t/tmp";
+
+ok( 'done' );
+
+sub check_port {
+ my ( $host, $port ) = @_;
+
+ my $remote = IO::Socket::INET->new(
+ Proto => "tcp",
+ PeerAddr => $host,
+ PeerPort => $port
+ );
+ if ($remote) {
+ close $remote;
+ return 1;
+ }
+ else {
+ return 0;
+ }
+}
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/optional_httpengine-server.t
___________________________________________________________________
Name: svn:keywords
+ Id
Added: Catalyst-Engine-HTTPEngine/trunk/t/testapp_httpengine.pl
===================================================================
--- Catalyst-Engine-HTTPEngine/trunk/t/testapp_httpengine.pl (rev 0)
+++ Catalyst-Engine-HTTPEngine/trunk/t/testapp_httpengine.pl 2008-09-28 22:46:28 UTC (rev 8466)
@@ -0,0 +1,56 @@
+#!/usr/bin/perl -w
+
+BEGIN {
+ $ENV{CATALYST_ENGINE} ||= 'HTTPEngine';
+}
+
+use strict;
+use Getopt::Long;
+use Pod::Usage;
+use FindBin;
+use lib "$FindBin::Bin/../lib";
+
+my $debug = 0;
+my $help = 0;
+my $host = undef;
+my $port = 3000;
+my $restart = 0;
+my $restart_delay = 1;
+my $restart_regex = '(?:/|^)(?!\.#).+(?:\.yml$|\.yaml$|\.pm)$';
+my $restart_directory = undef;
+my $follow_symlinks = 0;
+
+my @argv = @ARGV;
+
+GetOptions(
+ 'debug|d' => \$debug,
+ 'help|?' => \$help,
+ 'host=s' => \$host,
+ 'port=s' => \$port,
+ 'restart|r' => \$restart,
+ 'restartdelay|rd=s' => \$restart_delay,
+ 'restartregex|rr=s' => \$restart_regex,
+ 'restartdirectory=s@' => \$restart_directory,
+ 'followsymlinks' => \$follow_symlinks,
+);
+
+pod2usage(1) if $help;
+
+if ( $debug ) {
+ $ENV{CATALYST_DEBUG} = 1;
+}
+
+# This is require instead of use so that the above environment
+# variables can be set at runtime.
+require TestApp;
+
+TestApp->run( $port, $host, {
+ argv => \@argv,
+ restart => $restart,
+ restart_delay => $restart_delay,
+ restart_regex => qr/$restart_regex/,
+ restart_directory => $restart_directory,
+ follow_symlinks => $follow_symlinks,
+} );
+
+1;
Property changes on: Catalyst-Engine-HTTPEngine/trunk/t/testapp_httpengine.pl
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Id
More information about the Catalyst-commits
mailing list