forked from codeigniter4/CodeIgniter4
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path003.php
More file actions
38 lines (29 loc) · 1.03 KB
/
003.php
File metadata and controls
38 lines (29 loc) · 1.03 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
<?php
use CodeIgniter\Session\Handlers\ArrayHandler;
use CodeIgniter\Session\Session;
use CodeIgniter\Test\CIUnitTestCase;
use Config\Session as SessionConfig;
class SessionTest extends CIUnitTestCase
{
protected Session $testSession;
protected function setUp(): void
{
parent::setUp();
// Load session configuration
$config = new SessionConfig();
// Initialize ArrayHandler with config
$arrayHandler = new ArrayHandler($config, '127.0.0.1');
// Create session instance
$this->testSession = new Session($arrayHandler, $config);
}
public function testFrameworkNameInSession(): void
{
// Set a session value
$this->testSession->set('framework', 'CodeIgniter');
// Assert the value exists and is correct
$this->assertSame('CodeIgniter', $this->testSession->get('framework'));
// Remove the session value
$this->testSession->remove('framework');
$this->assertNull($this->testSession->get('framework'));
}
}