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