expectException(\RuntimeException::class, function () { new NativeSessionStorage([ 'save_path' => '/tmp/testnotfound', ]); }); $session = new NativeSessionStorage(); $session['username'] = 'myName'; $this->assertTrue($session->has('username')); $session['role'] = 'ADMIN'; $this->assertTrue($session->has('role')); $this->assertStrictEquals('myName', $session->get('username')); $article = [ 'title' => 'TV', 'description' => 'lorem', 'price' => 199.80 ]; $session->put('article',$article); $this->assertStrictEquals($article, $session->get('article')); $this->assertTrue(is_float($session->get('article')['price'])); $this->assertTrue(count($session->all()) === 3); $this->assertStrictEquals(null, $session->get('email')); $this->assertStrictEquals('dev@phpdevcommunity.com', $session->get('email', 'dev@phpdevcommunity.com')); } }