From: Kaare Rasmussen Date: Tue, 11 Aug 2015 19:20:37 +0000 (+0200) Subject: Added tests for (currently failing) type constraint controller actions X-Git-Tag: 5.90100~5 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=commitdiff_plain;h=fc036112266c785163c051608821d66f42757ed3 Added tests for (currently failing) type constraint controller actions - When using namespace::autoclean - When the acion is in a role --- diff --git a/t/arg_constraints.t b/t/arg_constraints.t index cb4d8cf..a8e8ae2 100644 --- a/t/arg_constraints.t +++ b/t/arg_constraints.t @@ -198,6 +198,47 @@ BEGIN { MyApp::Controller::Root->config(namespace=>''); + package MyApp::Controller::Autoclean; + $INC{'MyApp/Controller/Autoclean.pm'} = __FILE__; + + use Moose; + use MooseX::MethodAttributes; + use namespace::autoclean; + + use MyApp::Types qw/Int/; + + extends 'Catalyst::Controller'; + + sub an_int :Local Args(Int) { + my ($self, $c, $int) = @_; + $c->res->body('an_int (autoclean)'); + } + + MyApp::Controller::Autoclean->config(namespace=>'autoclean'); + + package MyApp::Role; + $INC{'MyApp/Role.pm'} = __FILE__; + + use Moose::Role; + use MooseX::MethodAttributes::Role; + + sub an_int :Local Args(Int) { + my ($self, $c, $int) = @_; + $c->res->body('an_int (withrole)'); + } + + package MyApp::Controller::WithRole; + $INC{'MyApp/Controller/WithRole.pm'} = __FILE__; + + use Moose; + use MooseX::MethodAttributes; + + extends 'Catalyst::Controller'; + + with 'MyApp::Role'; + + MyApp::Controller::WithRole->config(namespace=>'withrole'); + package MyApp; use Catalyst; @@ -421,6 +462,16 @@ SKIP: { is $res->content, 'default', "request '/stringy_enum/a'"; } +{ + my $res = request '/autoclean/an_int/1'; + is $res->content, 'an_int (autoclean)'; +} + +{ + my $res = request '/withrole/an_int/1'; + is $res->content, 'an_int (withrole)'; +} + =over | /chain_base/*/*/*/*/*/* | /chain_base (1)