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