public function testSetGet()
 {
     $session = new Session([]);
     $this->assertNull($session->get('unit'));
     $session->set('unit', 'test');
     $this->assertEquals('test', $session->get('unit'));
 }
Exemple #2
0
 /**
  * Set data into the session store.
  *
  * @param   string  $name   Name of a variable.
  * @param   mixed   $value  Value of a variable.
  *
  * @return  mixed  Old value of a variable.
  *
  * @since   1.5
  */
 public function set($name, $value = 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::set($name, $value);
 }