Adding some additional docs and VERSION, AUTHORITY stuff
[catagits/Web-Session.git] / t / 004_basic_file_w_customs.t
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;
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');
18 if ( !-d $TMP ) {
19     mkdir $TMP;
20 }
21
22 t::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
45 unlink $_ foreach glob( File::Spec->catdir($TMP, '*') );
46
47 done_testing;