[Catalyst-commits] r8028 - in trunk/CatalystX-Imports/t: . lib
lib/TestApp/Controller
rafl at dev.catalyst.perl.org
rafl at dev.catalyst.perl.org
Sat Jun 28 15:15:15 BST 2008
Author: rafl
Date: 2008-06-28 15:15:15 +0100 (Sat, 28 Jun 2008)
New Revision: 8028
Added:
trunk/CatalystX-Imports/t/25-vars-session.t
Modified:
trunk/CatalystX-Imports/t/lib/TestApp.pm
trunk/CatalystX-Imports/t/lib/TestApp/Controller/Vars.pm
Log:
Test session vars.
Added: trunk/CatalystX-Imports/t/25-vars-session.t
===================================================================
--- trunk/CatalystX-Imports/t/25-vars-session.t (rev 0)
+++ trunk/CatalystX-Imports/t/25-vars-session.t 2008-06-28 14:15:15 UTC (rev 8028)
@@ -0,0 +1,15 @@
+use strict;
+use warnings;
+
+use FindBin;
+use lib "$FindBin::Bin/lib";
+
+use Test::More tests => 3;
+
+use Test::WWW::Mechanize::Catalyst 'TestApp';
+
+my $ua = Test::WWW::Mechanize::Catalyst->new;
+
+$ua->get_ok('http://localhost/vars/set_session/23');
+$ua->get_ok('http://localhost/vars/test_session');
+$ua->content_is('23');
Modified: trunk/CatalystX-Imports/t/lib/TestApp/Controller/Vars.pm
===================================================================
--- trunk/CatalystX-Imports/t/lib/TestApp/Controller/Vars.pm 2008-06-28 14:15:02 UTC (rev 8027)
+++ trunk/CatalystX-Imports/t/lib/TestApp/Controller/Vars.pm 2008-06-28 14:15:15 UTC (rev 8028)
@@ -6,7 +6,8 @@
use CatalystX::Imports
Context => ':all',
- Vars => { Stash => [qw( $foo @bar %baz )] };
+ Vars => { Stash => [qw( $foo @bar %baz )],
+ Session => [qw( $moo )] };
sub test_self: Local { $_[1]->res->body( ref $self ) }
sub test_ctx: Local { $_[1]->res->body( ref $ctx ) }
@@ -46,4 +47,12 @@
$ctx->res->body( join ', ', @args );
}
+sub set_session: Local {
+ $moo = $args[0];
+}
+
+sub test_session: Local {
+ $ctx->res->body( $moo );
+}
+
1;
Modified: trunk/CatalystX-Imports/t/lib/TestApp.pm
===================================================================
--- trunk/CatalystX-Imports/t/lib/TestApp.pm 2008-06-28 14:15:02 UTC (rev 8027)
+++ trunk/CatalystX-Imports/t/lib/TestApp.pm 2008-06-28 14:15:15 UTC (rev 8028)
@@ -5,6 +5,6 @@
use Catalyst;
__PACKAGE__->config(name => 'TestApp', home => '/some/dir');
-__PACKAGE__->setup;
+__PACKAGE__->setup(qw/Session Session::State::Cookie Session::Store::FastMmap/);
1;
More information about the Catalyst-commits
mailing list