コード例 #1
0
 /**
  * @covers chromephpFile::_getFileName
  */
 public function testGetFileName()
 {
     $oTestObj = $this->getProxyClass('chromephpFile');
     $this->assertSame('_shop', $oTestObj->UNITgetFileName());
     modSession::getInstance()->setVar('debugPHP', 'test');
     $this->assertSame('test_shop', $oTestObj->UNITgetFileName());
 }
コード例 #2
0
 /**
  * @covers chromephpMySql::_saveResultToMysql
  */
 public function testSaveResultToMysql()
 {
     modSession::getInstance()->setVar('debugPHP', 'oxidTest');
     // $oTest = new chromephpMySql();
     // $oTest->log('testUnit', 'unit');
     $oTestObj = $this->getProxyClass('chromephpMySql');
     $this->assertNull($oTestObj->UNITsaveResultToMysql());
     // $sCheckOxid = oxDb::getDb( oxDB::FETCH_MODE_ASSOC )->getOne( "select oxid from oxactions2article where oxactionid = '".$this->_oAction->getId()."' and oxartid = '$sArtOxid' ");
 }
コード例 #3
0
 public static function getSession()
 {
     return modSession::getInstance();
 }
コード例 #4
0
ファイル: oxsession.php プロジェクト: mibexx/oxid_yttutorials
 /**
  * Destroys a single element (passed to method) of an session array.
  *
  * @param string $name Name of parameter to destroy
  *
  * @return null
  */
 public function deleteVariable($name)
 {
     if (defined('OXID_PHP_UNIT')) {
         if (isset(modSession::$unitMOD) && is_object(modSession::$unitMOD)) {
             try {
                 return modSession::getInstance()->setVar($name, null);
             } catch (Exception $e) {
                 // if exception is thrown, use default
             }
         }
     }
     $_SESSION[$name] = null;
     //logger( "delete sessionvar : $name");
     unset($_SESSION[$name]);
 }
コード例 #5
0
 public function cleanup()
 {
     if ($this->_oRealInstance) {
         $this->_oRealInstance->setId($this->_id);
     }
     self::$unitMOD = null;
     self::$unitCustMOD = null;
     parent::cleanup();
     $this->_aSessionVars = array();
 }
コード例 #6
0
ファイル: oxlang.php プロジェクト: mibexx/oxid_yttutorials
 /**
  * Validates and sets templates language id
  *
  * @param int $iLang Language id
  *
  * @return null
  */
 public function setTplLanguage($iLang = null)
 {
     $this->_iTplLanguageId = isset($iLang) ? (int) $iLang : $this->getBaseLanguage();
     if ($this->isAdmin()) {
         $aLanguages = $this->getAdminTplLanguageArray();
         if (!isset($aLanguages[$this->_iTplLanguageId])) {
             $this->_iTplLanguageId = key($aLanguages);
         }
     }
     if (defined('OXID_PHP_UNIT')) {
         modSession::getInstance();
     }
     oxRegistry::getSession()->setVariable('tpllanguage', $this->_iTplLanguageId);
     return $this->_iTplLanguageId;
 }
コード例 #7
0
ファイル: OxidTestCase.php プロジェクト: OXIDprojects/debugax
 /**
  * Executed after test is down
  *
  */
 protected function tearDown()
 {
     oxTestsStaticCleaner::clean('oxSeoEncoder', '_instance');
     oxTestsStaticCleaner::clean('oxSeoEncoderArticle', '_instance');
     oxTestsStaticCleaner::clean('oxSeoEncoderCategory', '_instance');
     oxTestsStaticCleaner::clean('oxVatSelector', '_instance');
     oxTestsStaticCleaner::clean('oxDiscountList', '_instance');
     oxTestsStaticCleaner::clean('oxUtilsObject', '_aInstanceCache');
     oxTestsStaticCleaner::clean('oxArticle', '_aLoadedParents');
     modInstances::cleanup();
     oxTestModules::cleanUp();
     modOxid::globalCleanup();
     modSession::getInstance()->cleanup();
     modDb::getInstance()->cleanup();
     modConfig::getInstance()->cleanup();
     $_SERVER = $this->_aBackup['_SERVER'];
     $_POST = $this->_aBackup['_POST'];
     $_GET = $this->_aBackup['_GET'];
     $_SESSION = $this->_aBackup['_SESSION'];
     $_COOKIE = $this->_aBackup['_COOKIE'];
     parent::tearDown();
     //oxTestRegister::execute();
 }
コード例 #8
0
ファイル: oxconfig.php プロジェクト: ioanok/symfoxid
 /**
  * Returns value of parameter stored in POST,GET.
  * For security reasons performed oxconfig->checkParamSpecialChars().
  * use $blRaw very carefully if you want to get unescaped
  * parameter.
  *
  * @param string $sName Name of parameter
  * @param bool   $blRaw Get unescaped parameter
  *
  * @return mixed
  */
 public function getRequestParameter($sName, $blRaw = false)
 {
     if (defined('OXID_PHP_UNIT')) {
         if (isset(modConfig::$unitMOD) && is_object(modConfig::$unitMOD)) {
             try {
                 $sValue = modConfig::getRequestParameter($sName, $blRaw);
                 // TODO: remove this after special chars concept implementation
                 $blIsAdmin = modConfig::getInstance()->isAdmin() || modSession::getInstance()->getVariable("blIsAdmin");
                 if ($sValue !== null && !$blIsAdmin && (!$blRaw || is_array($blRaw))) {
                     $this->checkParamSpecialChars($sValue, $blRaw);
                 }
                 return $sValue;
             } catch (Exception $e) {
                 // if exception is thrown, use default
             }
         }
     }
     $sValue = null;
     if (isset($_POST[$sName])) {
         $sValue = $_POST[$sName];
     } elseif (isset($_GET[$sName])) {
         $sValue = $_GET[$sName];
     }
     // TODO: remove this after special chars concept implementation
     $blIsAdmin = $this->isAdmin() && $this->getSession()->getVariable("blIsAdmin");
     if ($sValue !== null && !$blIsAdmin && (!$blRaw || is_array($blRaw))) {
         $this->checkParamSpecialChars($sValue, $blRaw);
     }
     return $sValue;
 }