/** * Returns a unique instance (Singleton) of the object. Use this method instead of the private/protected class constructor. * * @param void * @return Tx_PtExtbase_State_Session_Storage_FeUserSessionAdapter unique instance of the object (Singleton) */ public static function getInstance() { if (self::$uniqueInstance === null) { $className = __CLASS__; self::$uniqueInstance = new $className(); } return self::$uniqueInstance; }
/** @test */ public function deleteThrowsExceptionIfNoUserSessionIsAvailable() { $tmp = $GLOBALS['TSFE']->fe_user; try { $feSessionAdapter = Tx_PtExtbase_State_Session_Storage_FeUserSessionAdapter::getInstance(); $feSessionAdapter->delete('test'); } catch (Exception $e) { $GLOBALS['TSFE']->fe_user = $tmp; return; } $this->fail('Tx_PtExtbase_State_Session_Storage_FeUserSessionAdapter throws no Exception on store, if no user session is available!'); }