public function testSession() { SessionHandler::set('test1', 1); SessionHandler::set('test2', '1213'); $this->assertEquals(1, SessionHandler::get('test1')); $this->assertEquals(1, SessionHandler::get('testDoesNotExist', 1)); $this->assertEquals('1213', SessionHandler::get('test2')); }
/** * * Gets a value from the session, if the key doesn't exist will return the default * * @param $key * @param null $default * * @return mixed */ public static function get($key, $default = null) { return SessionHandler::has($key) ? $_SESSION[$key] : $default; }
/** * Clears the token * * @return bool */ public function clearToken() { return SessionHandler::remove('accessToken'); }