e5f6817741d9e21cbcd9043f2cb46c592bc3eec1
[catagits/Web-Session.git] / t / 003_basic_w_file_store.t
1 #!/usr/bin/perl
2
3 use strict;
4 use warnings;
5 use File::Spec;
6
7 use Test::More;
8
9 use Plack::Request;
10 use Plack::Session;
11 use Plack::Session::State::Cookie;
12 use Plack::Session::Store::File;
13
14 use t::lib::TestSession;
15
16 my $TMP = File::Spec->catdir('t', 'tmp');
17 if ( !-d $TMP ) {
18     mkdir $TMP;
19 }
20
21 t::lib::TestSession::run_all_tests(
22     store           => Plack::Session::Store::File->new( dir => $TMP ),
23     state           => Plack::Session::State->new,
24     request_creator => sub {
25         open my $in, '<', \do { my $d };
26         my $env = {
27             'psgi.version'    => [ 1, 0 ],
28             'psgi.input'      => $in,
29             'psgi.errors'     => *STDERR,
30             'psgi.url_scheme' => 'http',
31             SERVER_PORT       => 80,
32             REQUEST_METHOD    => 'GET',
33         };
34         my $r = Plack::Request->new( $env );
35         $r->parameters( @_ );
36         $r;
37     },
38 );
39
40 unlink $_ foreach glob( File::Spec->catdir($TMP, '*') );
41
42 done_testing;