Commit | Line | Data |
7ea446f1 |
1 | #!/usr/bin/perl |
2 | |
3 | use strict; |
4 | use warnings; |
5 | use File::Spec; |
6 | use Test::Requires 'YAML'; |
7 | |
8 | use Test::More; |
9 | |
10 | use Plack::Request; |
11 | use Plack::Session::State::Cookie; |
12 | use Plack::Session::Store::File; |
13 | |
14 | use t::lib::TestSessionHash; |
15 | |
16 | my $TMP = File::Spec->catdir('t', 'tmp'); |
17 | if ( !-d $TMP ) { |
18 | mkdir $TMP; |
19 | } |
20 | |
21 | t::lib::TestSessionHash::run_all_tests( |
22 | store => Plack::Session::Store::File->new( |
23 | dir => $TMP, |
24 | serializer => sub { YAML::DumpFile( reverse @_ ) }, # YAML takes it's args the opposite of Storable |
25 | deserializer => sub { YAML::LoadFile( @_ ) }, |
26 | ), |
27 | state => Plack::Session::State->new, |
28 | env_cb => sub { |
29 | open my $in, '<', \do { my $d }; |
30 | my $env = { |
31 | 'psgi.version' => [ 1, 0 ], |
32 | 'psgi.input' => $in, |
33 | 'psgi.errors' => *STDERR, |
34 | 'psgi.url_scheme' => 'http', |
35 | SERVER_PORT => 80, |
36 | REQUEST_METHOD => 'GET', |
37 | QUERY_STRING => join "&" => map { $_ . "=" . $_[0]->{ $_ } } keys %{$_[0] || +{}}, |
38 | }; |
39 | }, |
40 | ); |
41 | |
42 | unlink $_ foreach glob( File::Spec->catdir($TMP, '*') ); |
43 | |
44 | done_testing; |