Skip to content

Commit 6079330

Browse files
committed
test: add delete tests
1 parent bf0e6e7 commit 6079330

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

tests/delete.test.php

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<?php
2+
3+
test('values can be removed from session', function () {
4+
$name = 'John Doe Again';
5+
6+
$session = new \Leaf\Http\Session();
7+
$session->set('name', $name);
8+
9+
expect($session->get('name'))->toBe($name);
10+
11+
$session->unset('name');
12+
13+
expect($session->get('name'))->toBe(null);
14+
});
15+
16+
test('values can be removed from session using array', function () {
17+
$name = 'John Doe Again';
18+
19+
$session = new \Leaf\Http\Session();
20+
$session->set('name', $name);
21+
22+
expect($session->get('name'))->toBe($name);
23+
24+
$session->unset(['name']);
25+
26+
expect($session->get('name'))->toBe(null);
27+
});
28+
29+
test('values can be removed from session using dot notation', function () {
30+
$name = 'John Doe Again';
31+
32+
$session = new \Leaf\Http\Session();
33+
$session->set('user.name', $name);
34+
35+
expect($session->get('user.name'))->toBe($name);
36+
37+
$session->unset('user.name');
38+
39+
echo json_encode($_SESSION);
40+
41+
expect($session->get('user.name'))->toBe(null);
42+
});

0 commit comments

Comments
 (0)