Passed
Push — master ( 47ed03...40b80b )
by K
13:10
created

SessionTest::testSet()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 4
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Unit;
6
7
use Codeception\Test\Unit;
8
use PerfectApp\Session\Session;
9
10
class SessionTest extends Unit
11
{
12
    private Session $session;
13
14
    protected function _before()
15
    {
16
        $this->session = new Session(['username' => 'johndoe']);
17
    }
18
19
    public function testGet()
20
    {
21
        $this->assertEquals('johndoe', $this->session->get('username'));
22
        $this->assertNull($this->session->get('password'));
23
    }
24
25
    public function testSet()
26
    {
27
        $this->session->set('username', 'janedoe');
28
        $this->assertEquals('janedoe', $this->session->get('username'));
29
    }
30
31
    public function testDelete()
32
    {
33
        $this->session->delete('username');
34
        $this->assertNull($this->session->get('username'));
35
    }
36
}
37