/** * @magentoComponentsDir Magento/Framework/View/_files/Fixture_Module */ public function testGetViewFile() { $expected = '%s/frontend/Vendor/custom_theme/Fixture_Module/web/fixture_script.js'; $params = ['theme' => 'Vendor_FrameworkThemeTest/custom_theme']; $actual = $this->_model->getStaticFileName('Fixture_Module::fixture_script.js', $params); $this->_testExpectedVersusActualFilename($expected, $actual); }
public function testGetViewFile() { $params = ['area' => 'some_area', 'themeModel' => $this->getMock('Magento\\Framework\\View\\Design\\ThemeInterface', [], [], '', false, false), 'locale' => 'some_locale', 'module' => 'Some_Module']; $file = 'Some_Module::some_file.ext'; $expected = 'path/to/some_file.ext'; $this->_staticFileResolution->expects($this->once())->method('getFile')->with($params['area'], $params['themeModel'], $params['locale'], 'some_file.ext', 'Some_Module')->will($this->returnValue($expected)); $actual = $this->_model->getStaticFileName($file, $params); $this->assertEquals($expected, $actual); }
/** * Get relative watermark file path * or false if file not found * * @return string | bool */ protected function _getWatermarkFilePath() { $filePath = false; if (!($file = $this->getWatermarkFile())) { return $filePath; } $baseDir = $this->_catalogProductMediaConfig->getBaseMediaPath(); $candidates = array($baseDir . '/watermark/stores/' . $this->_storeManager->getStore()->getId() . $file, $baseDir . '/watermark/websites/' . $this->_storeManager->getWebsite()->getId() . $file, $baseDir . '/watermark/default/' . $file, $baseDir . '/watermark/' . $file); foreach ($candidates as $candidate) { if ($this->_mediaDirectory->isExist($candidate)) { $filePath = $this->_mediaDirectory->getAbsolutePath($candidate); break; } } if (!$filePath) { $filePath = $this->_viewFileSystem->getStaticFileName($file); } return $filePath; }