testcase for Chained bug - dispatches to wrong action
[catagits/Catalyst-Runtime.git] / t / lib / TestApp / Controller / Action / Chained / CaptureArgs.pm
CommitLineData
fd91d0c6 1package TestApp::Controller::Action::Chained::CaptureArgs;
2use warnings;
3use strict;
4
5use base qw( Catalyst::Controller );
6
7#
8# This controller builds two patterns of URI:
9# /captureargs/*/*
10# /captureargs/*/*/edit
11# /captureargs/*
12# /captureargs/*/edit
13# It will output the arguments they got passed to @_ after the
14# context object.
15# /captureargs/one/edit should not dispatch to
16# /captureargs/*/*
17
18sub base :Chained('/') PathPart('captureargs') CaptureArgs(0) {
19 my ( $self, $c, $arg ) = @_;
20 push @{ $c->stash->{ passed_args } }, 'base';
21}
22
23sub two_args :Chained('base') PathPart('') CaptureArgs(2) {
24 my ( $self, $c, $arg1, $arg2 ) = @_;
25 push @{ $c->stash->{ passed_args } }, 'two_args', $arg1, $arg2;
26}
27
28sub one_arg :Chained('base') ParthPart('') CaptureArgs(1) {
29 my ( $self, $c, $arg ) = @_;
30 push @{ $c->stash->{ passed_args } }, 'one_arg', $arg;
31}
32
33sub edit_two_args :Chained('two_args') PathPart('edit') Args(0) {
34 my ( $self, $c ) = @_;
35 push @{ $c->stash->{ passed_args } }, 'edit_two_args';
36}
37
38sub edit_one_arg :Chained('one_arg') PathPart('edit') Args(0) {
39 my ( $self, $c ) = @_;
40 push @{ $c->stash->{ passed_args } }, 'edit_one_arg';
41}
42
43sub view_two_args :Chained('two_args') PathPart('') Args(0) {
44 my ( $self, $c ) = @_;
45 push @{ $c->stash->{ passed_args } }, 'view_two_args';
46}
47
48sub view_one_arg :Chained('one_arg') PathPart('') Args(0) {
49 my ( $self, $c ) = @_;
50 push @{ $c->stash->{ passed_args } }, 'view_one_arg';
51}
52
53
54sub end : Private {
55 my ( $self, $c ) = @_;
56 no warnings 'uninitialized';
57 $c->response->body( join '; ', @{ $c->stash->{ passed_args } } );
58}
59
601;