Moved ACLTestApp from the test file to an app class and a root controller.
Yousef H. Alhashemi [Wed, 26 Aug 2009 15:38:02 +0000 (15:38 +0000)]
t/lib/ACLTestApp.pm [new file with mode: 0644]
t/lib/ACLTestApp/Controller/Root.pm [new file with mode: 0644]
t/lib/PluginTestApp/Controller/Root.pm
t/unit_dispatcher_requestargs_restore.t

diff --git a/t/lib/ACLTestApp.pm b/t/lib/ACLTestApp.pm
new file mode 100644 (file)
index 0000000..ec87027
--- /dev/null
@@ -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 (file)
index 0000000..2dd1c10
--- /dev/null
@@ -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;
index e784d96..5358074 100644 (file)
@@ -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';
index 731c4da..1ffff9c 100644 (file)
 # 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;