Debian Codegraph @

t/1-basic.t

raw symbols SCIP
1 use strict;
2 use Test::More tests => 4;
3
4 use_ok('Apache::Session::SQLite3');
5
6 use DBI;
7 use File::Temp qw(tempdir tempfile);
8
9 my $dir = tempdir( CLEANUP => 1 );
10 my($fh, $filename) = tempfile( DIR => $dir );
11 close($fh);
12
13 my $dbh = DBI->connect("dbi:SQLite:dbname=$filename","","") or die($!);
14
15 tie my %hash, 'Apache::Session::SQLite3', undef, {
16 DataSource => "dbi:SQLite:dbname=$filename",
17 } or die($!);
18
19 $hash{foo} = 'bar';
20 $hash{hash} = { foo => 'bar' };
21
22 my $sid = $hash{_session_id};
23
24 untie(%hash);
25
26 tie %hash, 'Apache::Session::SQLite3', $sid, {
27 DataSource => "dbi:SQLite:dbname=$filename",
28 } or die($!);
29
30 is($hash{foo}, 'bar', 'simple fetch works');
31 isa_ok($hash{hash}, 'HASH', 'stored reference');
32 is($hash{hash}{foo}, 'bar', 'multilevel fetch works');
33
34 1;