-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAPCSessionHandlerTest.php
More file actions
48 lines (39 loc) · 1.14 KB
/
Copy pathAPCSessionHandlerTest.php
File metadata and controls
48 lines (39 loc) · 1.14 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
45
46
47
48
<?php
namespace Detain\SessionSamuraiTest;
use PHPUnit\Framework\TestCase;
use Detain\SessionSamurai\ApcSessionHandler;
/**
* @requires extension apc
*/
class APCSessionHandlerTest extends TestCase
{
private ApcSessionHandler $handler;
public function setUp(): void
{
$this->handler = new ApcSessionHandler();
$this->handler->open('test_session', 'test_save_path');
}
public function testOpen(): void
{
$this->assertTrue($this->handler->open('test_session', 'test_save_path'));
}
public function testClose(): void
{
$this->assertTrue($this->handler->close());
}
public function testWrite(): void
{
$this->assertTrue($this->handler->write('key', 'value'));
}
public function testRead(): void
{
$this->handler->write('key', 'value');
$this->assertEquals('value', $this->handler->read('key'));
}
public function testDestroy(): void
{
$this->handler->write('destroykey', 'value');
$this->assertTrue($this->handler->destroy('destroykey'));
$this->assertSame('', $this->handler->read('destroykey'));
}
}