-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMemcachedHandlerTest.php
More file actions
executable file
·44 lines (35 loc) · 1.26 KB
/
MemcachedHandlerTest.php
File metadata and controls
executable file
·44 lines (35 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php
namespace Koded\Session\Handler;
use Koded\Session\{PhpSession, SessionTestCaseTrait};
use Koded\Stdlib\Config;
use PHPUnit\Framework\TestCase;
use function Koded\Session\session_register_custom_handler;
class MemcachedHandlerTest extends TestCase
{
use SessionTestCaseTrait;
protected function setUp()
{
if (false === extension_loaded('memcached')) {
$this->markTestSkipped('Memcached extension is not loaded');
}
$config = (new Config)->import([
'session' => [
'name' => 'test',
'save_handler' => 'memcached',
'expire_at_browser_close' => false,
'use_cookies' => false,
'cache_limiter' => '',
'gc_maxlifetime' => 60,
'servers' => [['memcached', 11211]],
'options' => [
\Memcached::OPT_DISTRIBUTION => null,
\Memcached::OPT_PREFIX_KEY => 'sess.'
],
]
]);
$settings = session_register_custom_handler($config);
session_start($settings->sessionParameters());
$this->SUT = new PhpSession;
$_SESSION['foo'] = 'bar';
}
}