[Catalyst-commits] r13188 - in
Catalyst-Runtime/5.80/branches/forward-comp-obj/t: aggregate
lib/TestApp/Controller/Action lib/TestApp/View
edenc at dev.catalyst.perl.org
edenc at dev.catalyst.perl.org
Wed Apr 28 19:41:04 GMT 2010
Author: edenc
Date: 2010-04-28 20:41:04 +0100 (Wed, 28 Apr 2010)
New Revision: 13188
Added:
Catalyst-Runtime/5.80/branches/forward-comp-obj/t/aggregate/unit_dispatcher_forward.t
Catalyst-Runtime/5.80/branches/forward-comp-obj/t/lib/TestApp/View/Dummy.pm
Modified:
Catalyst-Runtime/5.80/branches/forward-comp-obj/t/aggregate/live_component_controller_action_forward.t
Catalyst-Runtime/5.80/branches/forward-comp-obj/t/lib/TestApp/Controller/Action/Forward.pm
Log:
failing test case involving a forward to a component object
Modified: Catalyst-Runtime/5.80/branches/forward-comp-obj/t/aggregate/live_component_controller_action_forward.t
===================================================================
--- Catalyst-Runtime/5.80/branches/forward-comp-obj/t/aggregate/live_component_controller_action_forward.t 2010-04-28 18:40:52 UTC (rev 13187)
+++ Catalyst-Runtime/5.80/branches/forward-comp-obj/t/aggregate/live_component_controller_action_forward.t 2010-04-28 19:41:04 UTC (rev 13188)
@@ -10,7 +10,7 @@
BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; }
-use Test::More tests => 53 * $iters;
+use Test::More tests => 60 * $iters;
use Catalyst::Test 'TestApp';
if ( $ENV{CAT_BENCHMARK} ) {
@@ -107,6 +107,47 @@
}
{
+ my @expected = qw[
+ TestApp::Controller::Action::Forward->begin
+ TestApp::Controller::Action::Forward->compobj
+ TestApp::View::Dummy->process
+ 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::Controller::Root->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ # test forward to a component object
+ ok( my $response = request('http://localhost/action/forward/compobj'),
+ '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/compobj', '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'),
Added: Catalyst-Runtime/5.80/branches/forward-comp-obj/t/aggregate/unit_dispatcher_forward.t
===================================================================
--- Catalyst-Runtime/5.80/branches/forward-comp-obj/t/aggregate/unit_dispatcher_forward.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/forward-comp-obj/t/aggregate/unit_dispatcher_forward.t 2010-04-28 19:41:04 UTC (rev 13188)
@@ -0,0 +1,17 @@
+#!perl
+
+use strict;
+use warnings;
+
+use FindBin;
+use lib "$FindBin::Bin/../lib";
+
+use Test::More tests => 2;
+use Catalyst::Test 'TestApp';
+
+my($res, $ctx) = ctx_request('http://localhost/action/forward/compobj');
+
+my $ftarget = $ctx->stash->{forward_target};
+my $fto = $ctx->stash->{forwarded_to} || [!$ftarget];
+cmp_ok(scalar(@$fto), '==', 1);
+cmp_ok($ftarget, '==', $fto->[0]);
Modified: Catalyst-Runtime/5.80/branches/forward-comp-obj/t/lib/TestApp/Controller/Action/Forward.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/forward-comp-obj/t/lib/TestApp/Controller/Action/Forward.pm 2010-04-28 18:40:52 UTC (rev 13187)
+++ Catalyst-Runtime/5.80/branches/forward-comp-obj/t/lib/TestApp/Controller/Action/Forward.pm 2010-04-28 19:41:04 UTC (rev 13188)
@@ -34,6 +34,14 @@
$c->forward( $c->controller('Action::Forward'), 'three' );
}
+sub compobj : Local {
+ my ( $self, $c ) = @_;
+ my $view = $c->stash->{forward_target} = $c->view(Dummy => 'foo');
+ $c->forward($view);
+ $c->forward('one');
+ $c->forward( $c->controller('Action::Forward'), 'three' );
+}
+
sub inheritance : Local {
my ( $self, $c ) = @_;
$c->forward('/action/inheritance/a/b/default');
Added: Catalyst-Runtime/5.80/branches/forward-comp-obj/t/lib/TestApp/View/Dummy.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/forward-comp-obj/t/lib/TestApp/View/Dummy.pm (rev 0)
+++ Catalyst-Runtime/5.80/branches/forward-comp-obj/t/lib/TestApp/View/Dummy.pm 2010-04-28 19:41:04 UTC (rev 13188)
@@ -0,0 +1,17 @@
+package TestApp::View::Dummy;
+use Moose;
+
+BEGIN { extends 'Catalyst::View' }
+
+sub ACCEPT_CONTEXT {
+ my($self, $c, $data) = @_;
+ die 'ACCEPT_CONTEXT received no args' unless $data;
+ return $self;
+}
+
+sub process {
+ my($self, $c) = @_;
+ push @{$c->stash->{forwarded_to}}, $self;
+}
+
+1;
More information about the Catalyst-commits
mailing list