|
Lines 41-47
subtest 'new' => sub {
Link Here
|
| 41 |
}; |
41 |
}; |
| 42 |
|
42 |
|
| 43 |
subtest 'clear_unless' => sub { |
43 |
subtest 'clear_unless' => sub { |
| 44 |
plan tests => 15; |
44 |
plan tests => 16; |
| 45 |
|
45 |
|
| 46 |
t::lib::Mocks::mock_config( Koha::CookieManager::DENY_LIST_VAR, [ 'aap', 'noot' ] ); |
46 |
t::lib::Mocks::mock_config( Koha::CookieManager::DENY_LIST_VAR, [ 'aap', 'noot' ] ); |
| 47 |
|
47 |
|
|
Lines 73-78
subtest 'clear_unless' => sub {
Link Here
|
| 73 |
is( $rv[4]->value, q{}, 'zus empty' ); |
73 |
is( $rv[4]->value, q{}, 'zus empty' ); |
| 74 |
is( $rv[1]->httponly, 0, 'cleared wim is not httponly' ); |
74 |
is( $rv[1]->httponly, 0, 'cleared wim is not httponly' ); |
| 75 |
is( $rv[2]->httponly, 1, 'aap httponly' ); |
75 |
is( $rv[2]->httponly, 1, 'aap httponly' ); |
|
|
76 |
|
| 77 |
# Test with _123 prefix |
| 78 |
t::lib::Mocks::mock_config( Koha::CookieManager::DENY_LIST_VAR, [ 'catalogue_editor_' ] ); |
| 79 |
$cmgr = Koha::CookieManager->new; |
| 80 |
$cookie1 = $q->cookie( -name => 'catalogue_editor_234', -value => '1', -expires => '+1y' ); |
| 81 |
$cookie2 = $q->cookie( -name => 'catalogue_editor_345', -value => '1', -expires => '+1y' ); |
| 82 |
$cookie3 = $q->cookie( -name => 'catalogue_editor_', -value => '1', -expires => '+1y' ); |
| 83 |
$cookie4 = $q->cookie( -name => 'catalogue_editor', -value => '1', -expires => '+1y' ); |
| 84 |
|
| 85 |
$list = [ $cookie1, $cookie2, $cookie3, $cookie4 ]; |
| 86 |
@rv = @{$cmgr->clear_unless( @$list )}; |
| 87 |
is_deeply( [ map { $_->value ? $_->name : () } @rv ], |
| 88 |
[ 'catalogue_editor_234', 'catalogue_editor_345', 'catalogue_editor_' ], |
| 89 |
'Only cookie4 should have been cleared' ); |
| 76 |
}; |
90 |
}; |
| 77 |
|
91 |
|
| 78 |
subtest 'replace_in_list' => sub { |
92 |
subtest 'replace_in_list' => sub { |
| 79 |
- |
|
|