Пример #1
0
 /**
  * Adds tests sql data to database.
  *
  * @param string $testSuitePath
  */
 public function addTestData($testSuitePath)
 {
     $editionEntryPointProvider = new EditionRootPathProvider(new EditionSelector());
     $editionPathProvider = new EditionPathProvider($editionEntryPointProvider);
     $sInternationalConverter = $editionPathProvider->getDatabaseSqlDirectory() . '/en.sql';
     $this->importSql($sInternationalConverter);
     parent::addTestData($testSuitePath);
 }
 public function testReturnsSmartyPluginsDirectory()
 {
     $editionSelector = $this->getEditionPathSelectorMock();
     $editionPathSelector = new EditionPathProvider($editionSelector);
     $this->assertSame('/Core/Smarty/Plugin/', $editionPathSelector->getSmartyPluginsDirectory());
 }
Пример #3
0
 /**
  * Test if sql files don't have invalid encoding.
  */
 public function testSqlFilesForInvalidEncoding()
 {
     $pathProvider = new EditionPathProvider(new EditionRootPathProvider(new EditionSelector()));
     $filePathPattern = $pathProvider->getSetupDirectory() . '/Sql/*.sql';
     foreach (glob($filePathPattern) as $sFilePath) {
         if (is_readable($sFilePath)) {
             $sFileContent = file_get_contents($sFilePath);
             foreach (array(0xef, 0xbb, 0xbf, 0x9c) as $sCharacter) {
                 $this->assertFalse(strpos($sFileContent, $sCharacter), "Character with invalid encoding found in {$sFilePath} file.");
             }
         }
     }
 }
Пример #4
0
 /**
  * Returns array witn pathes + names ox manu xml files. Paths are checked
  *
  * @return array
  */
 protected function _getMenuFiles()
 {
     $myConfig = $this->getConfig();
     $myOxUtlis = oxRegistry::getUtils();
     $editionPathSelector = new EditionPathProvider(new EditionRootPathProvider(new EditionSelector()));
     $fullAdminDir = $editionPathSelector->getViewsDirectory() . 'admin' . DIRECTORY_SEPARATOR;
     $sMenuFile = $fullAdminDir . 'menu.xml';
     $sTmpDir = $myConfig->getConfigParam('sCompileDir');
     $sDynLang = $this->_getDynMenuLang();
     $sLocalDynPath = "{$sTmpDir}{$sDynLang}_dynscreen.xml";
     // including std file
     if (file_exists($sMenuFile)) {
         $aFilesToLoad[] = $sMenuFile;
     }
     // including custom file
     if (file_exists($fullAdminDir . 'user.xml')) {
         $aFilesToLoad[] = $fullAdminDir . 'user.xml';
     }
     // including module menu files
     $sPath = getShopBasePath();
     $oModulelist = oxNew('oxmodulelist');
     $aActiveModuleInfo = $oModulelist->getActiveModuleInfo();
     if (is_array($aActiveModuleInfo)) {
         foreach ($aActiveModuleInfo as $sModulePath) {
             $sFullPath = $sPath . "modules/" . $sModulePath;
             // missing file/folder?
             if (is_dir($sFullPath)) {
                 // including menu file
                 $sMenuFile = $sFullPath . "/menu.xml";
                 if (file_exists($sMenuFile) && is_readable($sMenuFile)) {
                     $aFilesToLoad[] = $sMenuFile;
                 }
             }
         }
     }
     $blLoadDynContents = $myConfig->getConfigParam('blLoadDynContents');
     $sShopCountry = $myConfig->getConfigParam('sShopCountry');
     // including dyn menu file
     $sDynPath = null;
     if ($blLoadDynContents) {
         if ($sShopCountry) {
             $sRemoteDynUrl = $this->_getDynMenuUrl($sDynLang, $blLoadDynContents);
             // loading remote file from server only once
             $blLoadRemote = oxRegistry::getSession()->getVariable("loadedremotexml");
             // very basic check if its valid xml file
             if ((!isset($blLoadRemote) || $blLoadRemote) && ($sDynPath = $myOxUtlis->getRemoteCachePath($sRemoteDynUrl, $sLocalDynPath))) {
                 $sDynPath = $this->_checkDynFile($sDynPath);
             }
             // caching last load state
             oxRegistry::getSession()->setVariable("loadedremotexml", $sDynPath ? true : false);
         }
     }
     // loading dynpages
     if ($sDynPath) {
         $aFilesToLoad[] = $sDynPath;
     }
     return $aFilesToLoad;
 }