Skip to content

Commit

Permalink
move setting deprecation session options into a legacy group test
Browse files Browse the repository at this point in the history
  • Loading branch information
xabbuh committed Sep 15, 2024
1 parent a414c5d commit ae0d217
Showing 1 changed file with 23 additions and 3 deletions.
26 changes: 23 additions & 3 deletions Tests/Session/Storage/NativeSessionStorageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -207,19 +207,39 @@ public function testCookieOptions()
$this->assertEquals($options, $gco);
}

public function testSessionOptions()
public function testCacheExpireOption()
{
$options = [
'trans_sid_tags' => 'a=href',
'cache_expire' => '200',
];

$this->getStorage($options);

$this->assertSame('a=href', \ini_get('session.trans_sid_tags'));
$this->assertSame('200', \ini_get('session.cache_expire'));
}

/**
* The test must only be removed when the "session.trans_sid_tags" option is removed from PHP or when the "trans_sid_tags" option is no longer supported by the native session storage.
*/
public function testTransSidTagsOption()
{
$previousErrorHandler = set_error_handler(function ($errno, $errstr) use (&$previousErrorHandler) {
if ('ini_set(): Usage of session.trans_sid_tags INI setting is deprecated' !== $errstr) {
return $previousErrorHandler ? $previousErrorHandler(...\func_get_args()) : false;
}
});

try {
$this->getStorage([
'trans_sid_tags' => 'a=href',
]);
} finally {
restore_error_handler();
}

$this->assertSame('a=href', \ini_get('session.trans_sid_tags'));
}

public function testSetSaveHandler()
{
$initialSaveHandler = ini_set('session.save_handler', 'files');
Expand Down

0 comments on commit ae0d217

Please sign in to comment.