[Catalyst-commits] r9430 - in Catalyst-Runtime/5.70/trunk: . t
t/lib/TestApp/Controller/Action
t0m at dev.catalyst.perl.org
t0m at dev.catalyst.perl.org
Wed Mar 4 23:19:20 GMT 2009
Author: t0m
Date: 2009-03-04 23:19:20 +0000 (Wed, 04 Mar 2009)
New Revision: 9430
Modified:
Catalyst-Runtime/5.70/trunk/Changes
Catalyst-Runtime/5.70/trunk/t/lib/TestApp/Controller/Action/Chained.pm
Catalyst-Runtime/5.70/trunk/t/lib/TestApp/Controller/Action/Visit.pm
Catalyst-Runtime/5.70/trunk/t/live_component_controller_action_visit.t
Log:
Backport failing test into 5.70 trunk
Modified: Catalyst-Runtime/5.70/trunk/Changes
===================================================================
--- Catalyst-Runtime/5.70/trunk/Changes 2009-03-04 21:52:30 UTC (rev 9429)
+++ Catalyst-Runtime/5.70/trunk/Changes 2009-03-04 23:19:20 UTC (rev 9430)
@@ -1,6 +1,8 @@
# This file documents the revision history for Perl extension Catalyst.
5.71000_01 UNRELEASED
+ - Add failing test for passing arguments to visited chained
+ actions (Radoslaw Zielinski)
- Support Moose components so that attribute defaults work
and BUILD methods are correctly called (t0m)
- Add tests for this (Florian Ragwitz)
Modified: Catalyst-Runtime/5.70/trunk/t/lib/TestApp/Controller/Action/Chained.pm
===================================================================
--- Catalyst-Runtime/5.70/trunk/t/lib/TestApp/Controller/Action/Chained.pm 2009-03-04 21:52:30 UTC (rev 9429)
+++ Catalyst-Runtime/5.70/trunk/t/lib/TestApp/Controller/Action/Chained.pm 2009-03-04 23:19:20 UTC (rev 9430)
@@ -15,7 +15,11 @@
#
# Simple parent/child action test
#
-sub foo :PathPart('chained/foo') :CaptureArgs(1) :Chained('/') { }
+sub foo :PathPart('chained/foo') :CaptureArgs(1) :Chained('/') {
+ my ( $self, $c, @args ) = @_;
+ die "missing argument" unless @args;
+ die "more than 1 argument" if @args > 1;
+}
sub endpoint :PathPart('end') :Chained('/action/chained/foo') :Args(1) { }
#
Modified: Catalyst-Runtime/5.70/trunk/t/lib/TestApp/Controller/Action/Visit.pm
===================================================================
--- Catalyst-Runtime/5.70/trunk/t/lib/TestApp/Controller/Action/Visit.pm 2009-03-04 21:52:30 UTC (rev 9429)
+++ Catalyst-Runtime/5.70/trunk/t/lib/TestApp/Controller/Action/Visit.pm 2009-03-04 23:19:20 UTC (rev 9430)
@@ -62,7 +62,9 @@
sub visit_chained : Local {
my ( $self, $c, $val ) = @_;
- $c->visit('/action/chained/foo/spoon',[1]);
+ $val eq 1 ? $c->visit( '/action/chained/foo/spoon', [$val] )
+ : $val eq 2 ? $c->visit( qw/ Action::Chained::Foo spoon /, [$val] )
+ : $c->visit( $c->controller('Action::Chained::Foo')->action_for('spoon'), [$val] )
}
sub view : Local {
Modified: Catalyst-Runtime/5.70/trunk/t/live_component_controller_action_visit.t
===================================================================
--- Catalyst-Runtime/5.70/trunk/t/live_component_controller_action_visit.t 2009-03-04 21:52:30 UTC (rev 9429)
+++ Catalyst-Runtime/5.70/trunk/t/live_component_controller_action_visit.t 2009-03-04 23:19:20 UTC (rev 9430)
@@ -10,7 +10,7 @@
BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; }
-use Test::More tests => 54 * $iters;
+use Test::More tests => 60 * $iters;
use Catalyst::Test 'TestApp';
if ( $ENV{CAT_BENCHMARK} ) {
@@ -271,10 +271,13 @@
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' );
+ for my $i ( 1..3 ) {
+ ok( my $response = request("http://localhost/action/visit/visit_chained/$i"),
+ "visit to chained + subcontroller endpoint for $i" );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, "Executed actions for $i" );
+ is( $response->content, "; $i", "Content OK for $i" );
+ }
}
}
More information about the Catalyst-commits
mailing list