updated absolute/relative tests/classes to global/local.
Marcus Ramberg [Thu, 14 Apr 2005 13:25:01 +0000 (13:25 +0000)]
t/component/controller/action/forward.t
t/component/controller/action/global.t
t/component/controller/action/local.t
t/lib/TestApp.pm
t/lib/TestApp/Controller/Action/Forward.pm
t/lib/TestApp/Controller/Action/Global.pm [moved from t/lib/TestApp/Controller/Action/Absolute.pm with 59% similarity]
t/lib/TestApp/Controller/Action/Local.pm [moved from t/lib/TestApp/Controller/Action/Relative.pm with 91% similarity]

index a031eee..ad62283 100644 (file)
@@ -24,10 +24,10 @@ use Catalyst::Test 'TestApp';
     my $expected = join( ", ", @expected );
 
    # Test forward to global private action
-    ok( my $response = request('http://localhost/main_action'), 'Request' );
+    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'), 'main_action', 'Main Class Action' );
+    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' );
index f859107..a5435cf 100644 (file)
@@ -11,28 +11,28 @@ use Catalyst::Test 'TestApp';
 
 
 {
-    ok( my $response = request('http://localhost/action_absolute_one'), 'Request' );
+    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_absolute_one', 'Test Action' );
-    is( $response->header('X-Test-Class'), 'TestApp::Controller::Action::Absolute', 'Test Class' );
+    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_absolute_two'), '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_absolute_two', 'Test Action' );
-    is( $response->header('X-Test-Class'), 'TestApp::Controller::Action::Absolute', 'Test Class' );
+    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_absolute_three'), '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_absolute_three', 'Test Action' );
-    is( $response->header('X-Test-Class'), 'TestApp::Controller::Action::Absolute', 'Test Class' );
+    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' );
 }
index 8408675..7ccf29f 100644 (file)
@@ -11,37 +11,37 @@ use Catalyst::Test 'TestApp';
 
 
 {
-    ok( my $response = request('http://localhost/action/relative/one'), 'Request' );
+    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/relative/one', 'Test Action' );
-    is( $response->header('X-Test-Class'), 'TestApp::Controller::Action::Relative', 'Test Class' );
+    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/relative/two'), 'Request' );
+    ok( my $response = request('http://localhost/action/local/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/two', 'Test Action' );
-    is( $response->header('X-Test-Class'), 'TestApp::Controller::Action::Relative', 'Test Class' );
+    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/relative/three'), 'Request' );
+    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/relative/three', 'Test Action' );
-    is( $response->header('X-Test-Class'), 'TestApp::Controller::Action::Relative', 'Test Class' );
+    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/relative/four/five/six'), '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/relative/four/five/six', 'Test Action' );
-    is( $response->header('X-Test-Class'), 'TestApp::Controller::Action::Relative', 'Test Class' );
+    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' );
 }
index eae7b07..2e9483e 100644 (file)
@@ -14,7 +14,7 @@ TestApp->setup;
 
 #sub execute { return shift->NEXT::execute(@_); } # does not work, bug?
 
-sub main_action : Private {
+sub global_action : Private {
     my ( $self, $c ) = @_;
     $c->forward('TestApp::View::Dump::Request');
 }
index 9bb4ae7..8a88e7f 100644 (file)
@@ -42,4 +42,10 @@ sub inheritance : Relative {
     $c->forward('five');
 }
 
+sub global : Relative {
+    my ( $self, $c ) = @_;
+    $c->forward('/global_action');
+}
+
+
 1;
similarity index 59%
rename from t/lib/TestApp/Controller/Action/Absolute.pm
rename to t/lib/TestApp/Controller/Action/Global.pm
index 91e77ba..8bc3008 100644 (file)
@@ -1,19 +1,19 @@
-package TestApp::Controller::Action::Absolute;
+package TestApp::Controller::Action::Global;
 
 use strict;
 use base 'TestApp::Controller::Action';
 
-sub action_absolute_one : Action Absolute {
+sub action_global_one : Action Absolute {
     my ( $self, $c ) = @_;
     $c->forward('TestApp::View::Dump::Request');
 }
 
-sub action_absolute_two : Action Global {
+sub action_global_two : Action Global {
     my ( $self, $c ) = @_;
     $c->forward('TestApp::View::Dump::Request');
 }
 
-sub action_absolute_three : Action Path('/action_absolute_three') {
+sub action_global_three : Action Path('/action_global_three') {
     my ( $self, $c ) = @_;
     $c->forward('TestApp::View::Dump::Request');
 }
similarity index 91%
rename from t/lib/TestApp/Controller/Action/Relative.pm
rename to t/lib/TestApp/Controller/Action/Local.pm
index dce2eb8..65f3293 100644 (file)
@@ -1,4 +1,4 @@
-package TestApp::Controller::Action::Relative;
+package TestApp::Controller::Action::Local;
 
 use strict;
 use base 'TestApp::Controller::Action';