[Catalyst-commits] r12705 - in trunk/Catalyst-Plugin-Session-PerUser: . lib/Catalyst/Plugin/Session t t/lib t/lib/PerUserTestApp t/lib/PerUserTestApp/Controller t/lib/User

t0m at dev.catalyst.perl.org t0m at dev.catalyst.perl.org
Thu Jan 21 09:44:21 GMT 2010


Author: t0m
Date: 2010-01-21 09:44:20 +0000 (Thu, 21 Jan 2010)
New Revision: 12705

Added:
   trunk/Catalyst-Plugin-Session-PerUser/t/lib/
   trunk/Catalyst-Plugin-Session-PerUser/t/lib/PerUserTestApp.pm
   trunk/Catalyst-Plugin-Session-PerUser/t/lib/PerUserTestApp/
   trunk/Catalyst-Plugin-Session-PerUser/t/lib/PerUserTestApp/Controller/
   trunk/Catalyst-Plugin-Session-PerUser/t/lib/PerUserTestApp/Controller/Root.pm
   trunk/Catalyst-Plugin-Session-PerUser/t/lib/User/
   trunk/Catalyst-Plugin-Session-PerUser/t/lib/User/WithSession.pm
Modified:
   trunk/Catalyst-Plugin-Session-PerUser/Changes
   trunk/Catalyst-Plugin-Session-PerUser/lib/Catalyst/Plugin/Session/PerUser.pm
   trunk/Catalyst-Plugin-Session-PerUser/t/live_app.t
Log:
Split testapp out to remove deprecation warnings

Modified: trunk/Catalyst-Plugin-Session-PerUser/Changes
===================================================================
--- trunk/Catalyst-Plugin-Session-PerUser/Changes	2010-01-21 09:35:49 UTC (rev 12704)
+++ trunk/Catalyst-Plugin-Session-PerUser/Changes	2010-01-21 09:44:20 UTC (rev 12705)
@@ -2,6 +2,7 @@
 
     - Switch to using Moose and MRO::Compat rather than NEXT and
       Class::Accessor::Fast (RT#53862)
+    - Split the TestApp out of the test file.
 
 0.04    2009-08-18 00:25:00
     - switch to Module::Install

Modified: trunk/Catalyst-Plugin-Session-PerUser/lib/Catalyst/Plugin/Session/PerUser.pm
===================================================================
--- trunk/Catalyst-Plugin-Session-PerUser/lib/Catalyst/Plugin/Session/PerUser.pm	2010-01-21 09:35:49 UTC (rev 12704)
+++ trunk/Catalyst-Plugin-Session-PerUser/lib/Catalyst/Plugin/Session/PerUser.pm	2010-01-21 09:44:20 UTC (rev 12705)
@@ -23,7 +23,7 @@
         %$cfg,
     );
 
-    $self->maybe::next::method(@_);
+    $self->next::method(@_);
 }
 
 sub set_authenticated {

Added: trunk/Catalyst-Plugin-Session-PerUser/t/lib/PerUserTestApp/Controller/Root.pm
===================================================================
--- trunk/Catalyst-Plugin-Session-PerUser/t/lib/PerUserTestApp/Controller/Root.pm	                        (rev 0)
+++ trunk/Catalyst-Plugin-Session-PerUser/t/lib/PerUserTestApp/Controller/Root.pm	2010-01-21 09:44:20 UTC (rev 12705)
@@ -0,0 +1,32 @@
+package PerUserTestApp::Controller::Root;
+use strict;
+use warnings;
+use base qw/Catalyst::Controller/;
+
+__PACKAGE__->config(namespace => '');
+
+sub add_item : Local {
+    my ( $self, $c, $item ) = @_;
+
+    $c->user_session->{items}{$item} = 1;
+}
+
+sub show_items : Local {
+    my ( $self, $c, $item ) = @_;
+
+    $c->res->body(
+        join( ", ", sort keys %{ $c->user_session->{items} ||= {} } ) );
+}
+
+sub auth_login : Local Args() {
+    my ( $self, $c, $name ) = @_;
+    $c->set_authenticated( $c->get_user($name) );
+}
+
+sub auth_logout : Local {
+    my ( $self, $c ) = @_;
+
+    $c->logout;
+}
+
+1;

Added: trunk/Catalyst-Plugin-Session-PerUser/t/lib/PerUserTestApp.pm
===================================================================
--- trunk/Catalyst-Plugin-Session-PerUser/t/lib/PerUserTestApp.pm	                        (rev 0)
+++ trunk/Catalyst-Plugin-Session-PerUser/t/lib/PerUserTestApp.pm	2010-01-21 09:44:20 UTC (rev 12705)
@@ -0,0 +1,23 @@
+package PerUserTestApp;
+use Catalyst qw/
+  Session
+  Session::Store::Dummy
+  Session::State::Cookie
+
+  Session::PerUser
+
+  Authentication
+  Authentication::Store::Minimal
+  /;
+  
+use User::WithSession;
+
+__PACKAGE__->config->{authentication}{users} = {
+    foo   => { id                       => "foo" },
+    bar   => { id                       => "bar" },
+    gorch => User::WithSession->new( id => "gorch" ),
+};
+
+__PACKAGE__->setup;
+
+1;

Added: trunk/Catalyst-Plugin-Session-PerUser/t/lib/User/WithSession.pm
===================================================================
--- trunk/Catalyst-Plugin-Session-PerUser/t/lib/User/WithSession.pm	                        (rev 0)
+++ trunk/Catalyst-Plugin-Session-PerUser/t/lib/User/WithSession.pm	2010-01-21 09:44:20 UTC (rev 12705)
@@ -0,0 +1,19 @@
+package User::WithSession;
+   use base qw/Catalyst::Plugin::Authentication::User::Hash/;
+
+   sub supports {
+       my ( $self, $feature ) = @_;
+
+       $feature eq "session_data" || $self->SUPER::supports($feature);
+   }
+   
+   sub get_session_data {
+       return shift->{session_data};
+   }
+   
+   sub store_session_data {
+       my ( $self, $data ) = @_;
+       return $self->{session_data} = $data;
+   }
+   
+1;

Modified: trunk/Catalyst-Plugin-Session-PerUser/t/live_app.t
===================================================================
--- trunk/Catalyst-Plugin-Session-PerUser/t/live_app.t	2010-01-21 09:35:49 UTC (rev 12704)
+++ trunk/Catalyst-Plugin-Session-PerUser/t/live_app.t	2010-01-21 09:44:20 UTC (rev 12705)
@@ -4,6 +4,8 @@
 use warnings;
 
 use Test::More;
+use FindBin qw/$Bin/;
+use lib "$Bin/lib";
 
 BEGIN {
     eval { require Test::WWW::Mechanize::Catalyst };
@@ -14,71 +16,6 @@
     plan tests => 43;
 }
 
-{
-
-    package User::WithSession;
-    use base qw/Catalyst::Plugin::Authentication::User::Hash/;
-
-    sub supports {
-        my ( $self, $feature ) = @_;
-
-        $feature eq "session_data" || $self->SUPER::supports($feature);
-    }
-    
-    sub get_session_data {
-        return shift->{session_data};
-    }
-    
-    sub store_session_data {
-        my ( $self, $data ) = @_;
-        return $self->{session_data} = $data;
-    }
-
-    package PerUserTestApp;
-    use Catalyst qw/
-      Session
-      Session::Store::Dummy
-      Session::State::Cookie
-
-      Session::PerUser
-
-      Authentication
-      Authentication::Store::Minimal
-      /;
-
-    sub add_item : Local {
-        my ( $self, $c, $item ) = @_;
-
-        $c->user_session->{items}{$item} = 1;
-    }
-
-    sub show_items : Local {
-        my ( $self, $c, $item ) = @_;
-
-        $c->res->body(
-            join( ", ", sort keys %{ $c->user_session->{items} ||= {} } ) );
-    }
-
-    sub auth_login : Local {
-        my ( $self, $c, $name ) = @_;
-        $c->set_authenticated( $c->get_user($name) );
-    }
-
-    sub auth_logout : Local {
-        my ( $self, $c ) = @_;
-
-        $c->logout;
-    }
-
-    __PACKAGE__->config->{authentication}{users} = {
-        foo   => { id                       => "foo" },
-        bar   => { id                       => "bar" },
-        gorch => User::WithSession->new( id => "gorch" ),
-    };
-
-    __PACKAGE__->setup;
-}
-
 use Test::WWW::Mechanize::Catalyst 'PerUserTestApp';
 
 my $m = Test::WWW::Mechanize::Catalyst->new;




More information about the Catalyst-commits mailing list