public function __construct($report_id)
 {
     parent::__construct();
     $this->report_id = $report_id;
     $this->report_namespace = $report_id;
     if (!isset($this->session['trackers']['reports'][$this->report_namespace]['has_changed'])) {
         $this->session['trackers']['reports'][$this->report_namespace] = array('has_changed' => false, 'checkout_date' => $_SERVER['REQUEST_TIME']);
     }
     $this->session_namespace =& $this->session['trackers']['reports'][$this->report_namespace];
     $this->session_namespace_path = ".trackers.reports.{$this->report_namespace}";
 }
Esempio n. 2
0
 protected function destroySession()
 {
     $session = new Codendi_Session();
     $session->destroy();
 }
Esempio n. 3
0
 public function test_Overloading_namespace()
 {
     $pseudo_php_session = array();
     $session = new Codendi_Session($pseudo_php_session);
     $this->assertFalse(isset($session->riri));
     $this->assertFalse(isset($pseudo_php_session['riri']));
     $session->changeSessionNamespace('riri');
     $this->assertFalse(isset($session->riri));
     $this->assertTrue(isset($pseudo_php_session['riri']));
     $session->fifi = 'loulou';
     $this->assertEqual($pseudo_php_session['riri']['fifi'], 'loulou');
     $this->assertEqual($session->fifi, 'loulou');
     $session->mickey = array('friend' => 'pluto');
     $session->changeSessionNamespace('mickey');
     $this->assertEqual($session->friend, 'pluto');
     $this->assertEqual($session->get('friend'), 'pluto');
     $this->assertEqual($pseudo_php_session['riri']['mickey']['friend'], 'pluto');
     $session->changeSessionNamespace('.');
     $this->assertNull($session->friend);
     $this->assertTrue(isset($session->riri));
     $session->changeSessionNamespace('.riri');
     $this->assertTrue(isset($session->mickey));
     $session->changeSessionNamespace('.');
     $session->changeSessionNamespace('riri.mickey');
     $this->assertTrue(isset($session->friend));
     $session->changeSessionNamespace('.riri.mickey');
     $this->assertTrue(isset($session->friend));
     // {{{ PHP prevents us to do thing like that. Which is too bad
     $session->changeSessionNamespace('.riri');
     //
     // Check behaviour __get and references.
     // The expected error (notice) is:
     // Unexpected PHP error [Indirect modification of overloaded property Codendi_Session::$fifi has no effect
     if (version_compare(PHP_VERSION, '5.2.0', '>=')) {
         // the error is raised only for further php version. 5.1.6 is silent
         $this->expectError();
     }
     //here you get the variable value not the reference
     $a =& $session->fifi;
     $a = 66;
     $this->assertEqual($session->fifi, 'loulou');
     // the workaround:
     //here you get the reference
     $b =& $session->get('fifi');
     $b = 66;
     $this->assertEqual($session->fifi, 66);
     // }}}
 }