public function testSetGet()
 {
     $session = new Session([]);
     $this->assertNull($session->get('unit'));
     $session->set('unit', 'test');
     $this->assertEquals('test', $session->get('unit'));
 }
Exemple #2
0
 /**
  * Get data from the session store
  *
  * @param   string  $name     Name of a variable
  * @param   mixed   $default  Default value of a variable if not set
  *
  * @return  mixed  Value of a variable
  *
  * @since   1.5
  */
 public function get($name, $default = null)
 {
     // Handle B/C by checking if a namespace was passed to the method, will be removed at 5.0
     if (func_num_args() > 2) {
         $args = func_get_args();
         if (!empty($args[2])) {
             JLog::add('Passing a namespace as a parameter to ' . __METHOD__ . '() is deprecated. The namespace should be prepended to the name instead.', JLog::WARNING, 'deprecated');
             $name = $args[2] . '.' . $name;
         }
     }
     return parent::get($name, $default);
 }