Added Session::Cookie middleware which utilizes Cookie as both state and store.
[catagits/Web-Session.git] / t / 004_basic_file_w_customs.t
CommitLineData
f331b3e0 1#!/usr/bin/perl
2
3use strict;
4use warnings;
5use File::Spec;
9bb20750 6use Test::Requires 'YAML';
f331b3e0 7
8use Test::More;
9
f331b3e0 10use Plack::Request;
11use Plack::Session;
12use Plack::Session::State::Cookie;
13use Plack::Session::Store::File;
14
15use t::lib::TestSession;
16
17my $TMP = File::Spec->catdir('t', 'tmp');
40cc4851 18if ( !-d $TMP ) {
19 mkdir $TMP;
20}
f331b3e0 21
22t::lib::TestSession::run_all_tests(
23 store => Plack::Session::Store::File->new(
24 dir => $TMP,
25 serializer => sub { YAML::DumpFile( reverse @_ ) }, # YAML takes it's args the opposite of Storable
26 deserializer => sub { YAML::LoadFile( @_ ) },
27 ),
28 state => Plack::Session::State->new,
29 request_creator => sub {
30 open my $in, '<', \do { my $d };
31 my $env = {
32 'psgi.version' => [ 1, 0 ],
33 'psgi.input' => $in,
34 'psgi.errors' => *STDERR,
35 'psgi.url_scheme' => 'http',
36 SERVER_PORT => 80,
37 REQUEST_METHOD => 'GET',
38 };
39 my $r = Plack::Request->new( $env );
40 $r->parameters( @_ );
41 $r;
42 },
43);
44
45unlink $_ foreach glob( File::Spec->catdir($TMP, '*') );
46
47done_testing;