Apache-Session-PHP

 view release on metacpan or  search on metacpan

t/03_taint.t  view on Meta::CPAN

# run things under taint mode

use strict;
use warnings;
use Test::More qw( no_plan ); 

my $sid; 
use_ok( 'Apache::Session::PHP' );

CREATE: {
    tie my %session, 'Apache::Session::PHP', $sid, { SavePath => 't' };
    $session{ foo } = 'bar';
    $sid = $session{ _session_id };
    ok( -f "t/sess_$sid", 'session file created' );
}

RESTORE: {
    tie my %session, 'Apache::Session::PHP', $sid, { SavePath => 't' };
    is( $session{ foo }, 'bar', 'restore' );
}

DELETE: {
    ok( -f "t/sess_$sid", 'session file exists' );
    tie my %session, 'Apache::Session::PHP', $sid, { SavePath => 't' };
    tied( %session )->delete();
    ok( ! -f "t/sess_$sid", 'session file gone' );
}



( run in 2.299 seconds using v1.01-cache-2.11-cpan-99c4e6809bf )