Commit | Line | Data |
f331b3e0 |
1 | #!/usr/bin/perl |
2 | |
3 | use strict; |
4 | use warnings; |
5 | use File::Spec; |
9bb20750 |
6 | use Test::Requires 'YAML'; |
f331b3e0 |
7 | |
8 | use Test::More; |
9 | |
f331b3e0 |
10 | use Plack::Request; |
11 | use Plack::Session; |
12 | use Plack::Session::State::Cookie; |
13 | use Plack::Session::Store::File; |
14 | |
15 | use t::lib::TestSession; |
16 | |
17 | my $TMP = File::Spec->catdir('t', 'tmp'); |
40cc4851 |
18 | if ( !-d $TMP ) { |
19 | mkdir $TMP; |
20 | } |
f331b3e0 |
21 | |
22 | t::lib::TestSession::run_all_tests( |
85265792 |
23 | store => Plack::Session::Store::File->new( |
f331b3e0 |
24 | dir => $TMP, |
25 | serializer => sub { YAML::DumpFile( reverse @_ ) }, # YAML takes it's args the opposite of Storable |
26 | deserializer => sub { YAML::LoadFile( @_ ) }, |
27 | ), |
85265792 |
28 | state => Plack::Session::State->new, |
29 | env_cb => sub { |
f331b3e0 |
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', |
85265792 |
38 | QUERY_STRING => join "&" => map { $_ . "=" . $_[0]->{ $_ } } keys %{$_[0] || +{}}, |
f331b3e0 |
39 | }; |
f331b3e0 |
40 | }, |
41 | ); |
42 | |
43 | unlink $_ foreach glob( File::Spec->catdir($TMP, '*') ); |
44 | |
45 | done_testing; |