Skip to content

Commit 833d3e7

Browse files
committed
test: add read tests
1 parent 6079330 commit 833d3e7

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

tests/read.test.php

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?php
2+
3+
test('values can be read from session', function () {
4+
$name = 'JMitchell';
5+
6+
$session = new \Leaf\Http\Session();
7+
$session->set('name', $name);
8+
9+
expect($session->get('name'))->toBe($name);
10+
});
11+
12+
test('values can be read from session using array', function () {
13+
$name = 'JMitchell';
14+
15+
$session = new \Leaf\Http\Session();
16+
$session->set('name', $name);
17+
18+
$data = $session->get(['name']);
19+
20+
expect($data['name'])->toBe($name);
21+
});
22+
23+
test('values can be read from session using dot notation', function () {
24+
$name = 'JMitchell';
25+
26+
$session = new \Leaf\Http\Session();
27+
$session->set('user.name', $name);
28+
29+
expect($session->get('user.name'))->toBe($name);
30+
});

0 commit comments

Comments
 (0)