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