From: Yousef H. Alhashemi Date: Wed, 26 Aug 2009 15:38:02 +0000 (+0000) Subject: Moved ACLTestApp from the test file to an app class and a root controller. X-Git-Tag: 5.80013~12^2~6 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=commitdiff_plain;h=b3986722960128cc5a6e406064438f2637a8d778 Moved ACLTestApp from the test file to an app class and a root controller. --- diff --git a/t/lib/ACLTestApp.pm b/t/lib/ACLTestApp.pm new file mode 100644 index 0000000..ec87027 --- /dev/null +++ b/t/lib/ACLTestApp.pm @@ -0,0 +1,26 @@ +package ACLTestApp; +use Test::More; + +use strict; +use warnings; +use MRO::Compat; +use Scalar::Util (); + +use base qw/Catalyst Catalyst::Controller/; +use Catalyst qw//; + +sub execute { + my $c = shift; + my ( $class, $action ) = @_; + + if ( Scalar::Util::blessed($action) + and $action->name ne "foobar" ) { + eval { $c->detach( 'foobar', [$action, 'foo'] ) }; + } + + $c->next::method( @_ ); +} + +__PACKAGE__->setup; + +1; diff --git a/t/lib/ACLTestApp/Controller/Root.pm b/t/lib/ACLTestApp/Controller/Root.pm new file mode 100644 index 0000000..2dd1c10 --- /dev/null +++ b/t/lib/ACLTestApp/Controller/Root.pm @@ -0,0 +1,17 @@ +package ACLTestApp::Controller::Root; + +use base 'Catalyst::Controller'; + +__PACKAGE__->config->{namespace} = ''; + +sub foobar : Private { + die $Catalyst::DETACH; +} + +sub gorch : Local { + my ( $self, $c, $frozjob ) = @_; + is $frozjob, 'wozzle'; + $c->res->body("gorch"); +} + +1; diff --git a/t/lib/PluginTestApp/Controller/Root.pm b/t/lib/PluginTestApp/Controller/Root.pm index e784d96..5358074 100644 --- a/t/lib/PluginTestApp/Controller/Root.pm +++ b/t/lib/PluginTestApp/Controller/Root.pm @@ -31,7 +31,7 @@ sub run_time_plugins : Local { # Trick perl into thinking the plugin is already loaded $INC{'Faux/Plugin.pm'} = 1; - __PACKAGE__->plugin( faux => $faux_plugin ); + ref($c)->plugin( faux => $faux_plugin ); isa_ok $c, 'Catalyst::Plugin::Test::Plugin'; isa_ok $c, 'TestApp::Plugin::FullyQualified'; diff --git a/t/unit_dispatcher_requestargs_restore.t b/t/unit_dispatcher_requestargs_restore.t index 731c4da..1ffff9c 100644 --- a/t/unit_dispatcher_requestargs_restore.t +++ b/t/unit_dispatcher_requestargs_restore.t @@ -10,42 +10,6 @@ # executing another action from the dispatcher (i.e. wrapping actions) # is present, so that the Authorization::ACL plugin can be re-written # to not be full of such crazy shit. -{ - package ACLTestApp; - use Test::More; - - use strict; - use warnings; - use MRO::Compat; - use Scalar::Util (); - - use base qw/Catalyst Catalyst::Controller/; - use Catalyst qw//; - - sub execute { - my $c = shift; - my ( $class, $action ) = @_; - - if ( Scalar::Util::blessed($action) - and $action->name ne "foobar" ) { - eval { $c->detach( 'foobar', [$action, 'foo'] ) }; - } - - $c->next::method( @_ ); - } - - sub foobar : Private { - die $Catalyst::DETACH; - } - - sub gorch : Local { - my ( $self, $c, $frozjob ) = @_; - is $frozjob, 'wozzle'; - $c->res->body("gorch"); - } - - __PACKAGE__->setup; -} use strict; use warnings;