Apache-Session-Browseable

 view release on metacpan or  search on metacpan

t/Apache-Session-Browseable-Redis.t  view on Meta::CPAN

ok( $r->sismember( "uid_obiwan", $id1 ),
    "Before update: id1 is in uid_obiwan index" );
$session1{uid} = 'benkenobi';
untie %session1;

ok( !$r->sismember( "uid_obiwan", $id1 ),
    "After update: id1 removed from old uid_obiwan index" );
ok( $r->sismember( "uid_benkenobi", $id1 ),
    "After update: id1 added to new uid_benkenobi index" );

# Verify searchOn uses the updated index
$hash = $package->searchOn( $args, 'uid', 'obiwan' );
is( keys %$hash, 0, "searchOn old value returns nothing" );

$hash = $package->searchOn( $args, 'uid', 'benkenobi' );
is( keys %$hash,            1,          "searchOn new value returns 1" );
is( $hash->{$id1}->{uid}, 'benkenobi', "Correct updated value" );

# Restore original value for subsequent tests
tie %session1, $package, $id1, $args;
$session1{uid} = 'obiwan';
untie %session1;

# Test that setting an indexed field to empty removes the index entry
tie %session1, $package, $id1, $args;
$session1{sn} = 'Kenobi';
untie %session1;



( run in 1.013 second using v1.01-cache-2.11-cpan-bbe5e583499 )