adding in tests for the raw HASH session
[catagits/Web-Session.git] / t / 003a_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::State::Cookie;
11 use Plack::Session::Store::File;
12
13 use t::lib::TestSessionHash;
14
15 my $TMP = File::Spec->catdir('t', 'tmp');
16 if ( !-d $TMP ) {
17     mkdir $TMP;
18 }
19
20 t::lib::TestSessionHash::run_all_tests(
21     store  => Plack::Session::Store::File->new( dir => $TMP ),
22     state  => Plack::Session::State->new,
23     env_cb => sub {
24         open my $in, '<', \do { my $d };
25         my $env = {
26             'psgi.version'    => [ 1, 0 ],
27             'psgi.input'      => $in,
28             'psgi.errors'     => *STDERR,
29             'psgi.url_scheme' => 'http',
30             SERVER_PORT       => 80,
31             REQUEST_METHOD    => 'GET',
32             QUERY_STRING      => join "&" => map { $_ . "=" . $_[0]->{ $_ } } keys %{$_[0] || +{}},
33         };
34     },
35 );
36
37 unlink $_ foreach glob( File::Spec->catdir($TMP, '*') );
38
39 done_testing;