root/Apache-Session-Serialize-YAML/trunk/t/01_session.t

Revision 680 (checked in by miyagawa, 18 years ago)

Initial revision

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1 use strict;
2 use Test::More tests => 3;
3
4 use Apache::Session::Flex;
5
6 # init
7
8 my %session;
9 tie %session, 'Apache::Session::Flex', undef, {
10     Store => 'File',
11     Lock => 'Null',
12     Generate => 'MD5',
13     Serialize => 'YAML',
14     Directory => 't/',
15 };
16
17 $session{foo} = "bar";
18 $session{bar} = { 'bar' => 1, 'baz' => 2 };
19
20 my $sid = $session{_session_id};
21 untie %session;
22
23 ok(-e "t/$sid", "file exists");
24
25 # reload
26
27 tie %session, 'Apache::Session::Flex', $sid, {
28     Store => 'File',
29     Lock => 'Null',
30     Generate => 'MD5',
31     Serialize => 'YAML',
32     Directory => 't/',
33 };
34
35 is $session{foo}, 'bar';
36 is_deeply $session{bar}, { 'bar' => 1, 'baz' => 2 };
37
38 tied(%session)->delete;
39
40 untie %session;
41
42
43
44
Note: See TracBrowser for help on using the browser.