Exemple #1
0
 /**
  * Find a static view file using fallback mechanism
  *
  * @param string $fileId
  * @param array $params
  * @return string
  */
 public function getStaticFileName($fileId, array $params = [])
 {
     list($module, $filePath) = \Magento\Framework\View\Asset\Repository::extractModule($this->normalizePath($fileId));
     if ($module) {
         $params['module'] = $module;
     }
     $this->_assetRepo->updateDesignParams($params);
     return $this->_staticFileResolution->getFile($params['area'], $params['themeModel'], $params['locale'], $filePath, $params['module']);
 }
Exemple #2
0
 /**
  * @param string $layoutFile
  * @param string $area
  * @param string $themePath
  * @param string $fileId
  * @dataProvider referencesFromLayoutFilesDataProvider
  */
 public function testReferencesFromLayoutFiles($layoutFile, $area, $themePath, $fileId)
 {
     list($module, $filePath) = \Magento\Framework\View\Asset\Repository::extractModule($fileId);
     $this->assertNotEmpty($this->getStaticFile($area, $themePath, 'en_US', $filePath, $module), "Unable to locate '{$fileId}' reference from layout XML in {$layoutFile}");
 }
 public function testExtractModule()
 {
     $this->assertEquals(['Module_One', 'File'], Repository::extractModule('Module_One::File'));
     $this->assertEquals(['', 'File'], Repository::extractModule('File'));
     $this->assertEquals(['Module_One', 'File::SomethingElse'], Repository::extractModule('Module_One::File::SomethingElse'));
 }
 /**
  * @param string $fileId
  * @return string
  * @throws \Magento\Framework\Exception\LocalizedException
  */
 public function getFixture($fileId)
 {
     list($moduleName, $filePath) = \Magento\Framework\View\Asset\Repository::extractModule($this->normalizePath($fileId));
     return $this->componentRegistrar->getPath(ComponentRegistrar::MODULE, $moduleName) . '/' . $filePath;
 }
 /**
  * @expectedException \Magento\Framework\Exception\LocalizedException
  * @expectedExceptionMessage Scope separator "::" cannot be used without scope identifier.
  * @return void
  */
 public function testExtractModuleException()
 {
     $this->repository->extractModule('::asdsad');
 }