forked from jasny/session-middleware
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAbstractSessionTest.php
More file actions
54 lines (40 loc) · 1.3 KB
/
Copy pathAbstractSessionTest.php
File metadata and controls
54 lines (40 loc) · 1.3 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
49
50
51
52
53
54
<?php
namespace Jasny\Session\Tests;
use Jasny\Session\SessionInterface;
use PHPUnit\Framework\TestCase;
abstract class AbstractSessionTest extends TestCase
{
protected SessionInterface $session;
abstract protected function assertSessionData(array $expected);
public function testStartStop()
{
$this->assertEquals(PHP_SESSION_ACTIVE, $this->session->status());
$this->session->stop();
$this->assertEquals(PHP_SESSION_NONE, $this->session->status());
$this->session->start();
$this->assertEquals(PHP_SESSION_ACTIVE, $this->session->status());
}
public function testAbort()
{
$this->session['zoo'] = 10;
$this->assertSessionData(['foo' => 'bar', 'zoo' => 10]);
$this->session->abort();
$this->session->start();
$this->assertSessionData(['foo' => 'bar']);
}
public function testAbortAfterStop()
{
$this->session['zoo'] = 10;
$this->session->stop();
$this->session->start();
$this->session->abort();
$this->session->start();
$this->assertSessionData(['foo' => 'bar', 'zoo' => 10]);
}
public function testClear()
{
$this->assertSessionData(['foo' => 'bar']);
$this->session->clear();
$this->assertSessionData([]);
}
}