Example #1
0
 /**
  * Find PageID in UIMap in the current area using full page URL
  *
  * @param string|null $url Full URL
  *
  * @return string
  */
 protected function _findCurrentPageFromUrl($url = null)
 {
     if (is_null($url)) {
         $url = str_replace($this->_urlPostfix, '', $this->getLocation());
     }
     $areasConfig = $this->_configHelper->getConfigAreas();
     $mca = self::_getMcaFromCurrentUrl($areasConfig, $url);
     $area = self::_getAreaFromCurrentUrl($areasConfig, $url);
     $page = $this->_uimapHelper->getUimapPageByMca($area, $mca, $this->_paramsHelper);
     return $page->getPageId();
 }
 /**
  * Get all paths to fixture files and all paths to include uimap elements
  * @return array
  */
 public function getConfigFixtures()
 {
     if (!empty($this->_configFixtures)) {
         return $this->_configFixtures;
     }
     //Get initial path to fixtures
     $frameworkConfig = $this->_configHelper->getConfigFramework();
     $initialPath = SELENIUM_TESTS_BASEDIR . DIRECTORY_SEPARATOR . $frameworkConfig['fixture_base_path'];
     //Get fixtures sequence
     $fallbackOrderFixture = $this->_configHelper->getFixturesFallbackOrder();
     //Get folder names where uimaps are stored for specified area
     $uimapFolders = array();
     $configAreas = $this->_configHelper->getConfigAreas();
     foreach ($configAreas as $areaName => $areaConfig) {
         $uimapFolders[$areaName] = $areaConfig['uimap_path'];
     }
     $separator = preg_quote(DIRECTORY_SEPARATOR);
     $facade = new File_Iterator_Facade();
     foreach ($fallbackOrderFixture as $codePoolName) {
         $projectPath = $initialPath . DIRECTORY_SEPARATOR . $codePoolName;
         if (!is_dir($projectPath)) {
             continue;
         }
         $files = $facade->getFilesAsArray($projectPath, '.yml');
         foreach ($files as $file) {
             if (preg_match('|' . $separator . 'data' . $separator . '|', $file)) {
                 $this->_configFixtures[$codePoolName]['data'][] = $file;
             }
             if (preg_match('|' . $separator . 'uimap' . $separator . '|', $file)) {
                 foreach ($uimapFolders as $areaName => $uimapFolder) {
                     $pattern = implode($separator, array('', 'uimap', $uimapFolder, ''));
                     if (preg_match('|' . $pattern . '|', $file)) {
                         $this->_configFixtures[$codePoolName]['uimap'][$areaName][] = $file;
                     }
                 }
             }
             if (preg_match('|' . $separator . self::UIMAP_INCLUDE_FOLDER . $separator . '|', $file)) {
                 foreach ($uimapFolders as $areaName => $uimapFolder) {
                     $pattern = implode($separator, array('', self::UIMAP_INCLUDE_FOLDER, $uimapFolder)) . '\\.yml';
                     if (preg_match('|' . $pattern . '|', $file)) {
                         $this->_configFixtures['uimapInclude'][$areaName][] = $file;
                     }
                 }
             }
         }
     }
     return $this->_configFixtures;
 }