public function testGetFile() { $theme = $this->getMockForAbstractClass('\\Magento\\Framework\\View\\Design\\ThemeInterface'); $expected = 'some/file.ext'; $this->resolver->expects($this->once())->method('resolve')->with(RulePool::TYPE_TEMPLATE_FILE, 'file.ext', 'frontend', $theme, null, 'Magento_Module')->will($this->returnValue($expected)); $actual = $this->object->getFile('frontend', $theme, 'file.ext', 'Magento_Module'); $this->assertSame($expected, $actual); }
public function testGetTemplateFileName() { $params = array('area' => 'some_area', 'themeModel' => $this->getMock('Magento\\Framework\\View\\Design\\ThemeInterface', array(), array(), '', false, false), 'module' => 'Some_Module'); $file = 'Some_Module::some_file.ext'; $expected = 'path/to/some_file.ext'; $this->_templateFileResolution->expects($this->once())->method('getFile')->with($params['area'], $params['themeModel'], 'some_file.ext', 'Some_Module')->will($this->returnValue($expected)); $this->_assetRepo->expects($this->any())->method('extractScope')->with($file, $params)->will($this->returnValue('some_file.ext')); $actual = $this->_model->getTemplateFileName($file, $params); $this->assertEquals($expected, $actual); }
/** * Get a template file * * @param string $fileId * @param array $params * @return string|bool */ public function getTemplateFileName($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->_templateFileResolution->getFile($params['area'], $params['themeModel'], $filePath, $params['module']); }