本文整理汇总了PHP中Magento\Framework\View\Design\ThemeInterface类的典型用法代码示例。如果您正苦于以下问题:PHP ThemeInterface类的具体用法?PHP ThemeInterface怎么用?PHP ThemeInterface使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ThemeInterface类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: getFiles
/**
* Retrieve files
*
* @param ThemeInterface $theme
* @param string $filePath
* @return array|\Magento\Framework\View\File[]
* @throws \Magento\Framework\Exception
*/
public function getFiles(ThemeInterface $theme, $filePath)
{
$namespace = $module = '*';
$themePath = $theme->getFullPath();
$searchPattern = "{$themePath}/{$namespace}_{$module}/{$this->subDir}*/*/{$filePath}";
$files = $this->themesDirectory->search($searchPattern);
if (empty($files)) {
return [];
}
$themes = [];
$currentTheme = $theme;
while ($currentTheme = $currentTheme->getParentTheme()) {
$themes[$currentTheme->getCode()] = $currentTheme;
}
$result = [];
$pattern = "#/(?<module>[^/]+)/{$this->subDir}(?<themeVendor>[^/]+)/(?<themeName>[^/]+)/" . strtr(preg_quote($filePath), ['\\*' => '[^/]+']) . "\$#i";
foreach ($files as $file) {
$filename = $this->themesDirectory->getAbsolutePath($file);
if (!preg_match($pattern, $filename, $matches)) {
continue;
}
$moduleFull = $matches['module'];
$ancestorThemeCode = $matches['themeVendor'] . '/' . $matches['themeName'];
if (!isset($themes[$ancestorThemeCode])) {
throw new Exception(sprintf("Trying to override modular view file '%s' for theme '%s', which is not ancestor of theme '%s'", $filename, $ancestorThemeCode, $theme->getCode()));
}
$result[] = $this->fileFactory->create($filename, $moduleFull, $themes[$ancestorThemeCode]);
}
return $result;
}
开发者ID:shabbirvividads,项目名称:magento2,代码行数:38,代码来源:ThemeModular.php
示例2: getFiles
/**
* Retrieve files
*
* @param ThemeInterface $theme
* @param string $filePath
* @return \Magento\Framework\View\File[]
*/
public function getFiles(ThemeInterface $theme, $filePath)
{
$namespace = $module = '*';
$themePath = $theme->getFullPath();
if (empty($themePath)) {
return [];
}
$themeAbsolutePath = $this->componentRegistrar->getPath(ComponentRegistrar::THEME, $themePath);
if (!$themeAbsolutePath) {
return [];
}
$themeDir = $this->readDirFactory->create($themeAbsolutePath);
$searchPattern = "{$namespace}_{$module}/{$this->subDir}{$filePath}";
$files = $themeDir->search($searchPattern);
$result = [];
$pattern = "#(?<moduleName>[^/]+)/{$this->subDir}" . $this->pathPatternHelper->translatePatternFromGlob($filePath) . "\$#i";
foreach ($files as $file) {
$filename = $themeDir->getAbsolutePath($file);
if (!preg_match($pattern, $filename, $matches)) {
continue;
}
$result[] = $this->fileFactory->create($filename, $matches['moduleName']);
}
return $result;
}
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:32,代码来源:Base.php
示例3: getFiles
/**
* Retrieve files
*
* @param ThemeInterface $theme
* @param string $filePath
* @return array|\Magento\Framework\View\File[]
*/
public function getFiles(ThemeInterface $theme, $filePath)
{
$result = [];
$namespace = $module = '*';
$sharedFiles = $this->modulesDirectory->search("{$namespace}/{$module}/view/base/{$this->subDir}{$filePath}");
$filePathPtn = strtr(preg_quote($filePath), ['\\*' => '[^/]+']);
$pattern = "#(?<namespace>[^/]+)/(?<module>[^/]+)/view/base/{$this->subDir}" . $filePathPtn . "\$#i";
foreach ($sharedFiles as $file) {
$filename = $this->modulesDirectory->getAbsolutePath($file);
if (!preg_match($pattern, $filename, $matches)) {
continue;
}
$moduleFull = "{$matches['namespace']}_{$matches['module']}";
$result[] = $this->fileFactory->create($filename, $moduleFull, null, true);
}
$area = $theme->getData('area');
$themeFiles = $this->modulesDirectory->search("{$namespace}/{$module}/view/{$area}/{$this->subDir}{$filePath}");
$pattern = "#(?<namespace>[^/]+)/(?<module>[^/]+)/view/{$area}/{$this->subDir}" . $filePathPtn . "\$#i";
foreach ($themeFiles as $file) {
$filename = $this->modulesDirectory->getAbsolutePath($file);
if (!preg_match($pattern, $filename, $matches)) {
continue;
}
$moduleFull = "{$matches['namespace']}_{$matches['module']}";
$result[] = $this->fileFactory->create($filename, $moduleFull);
}
return $result;
}
开发者ID:shabbirvividads,项目名称:magento2,代码行数:35,代码来源:Base.php
示例4: create
/**
* Create new config object
*
* @param ThemeInterface $theme
* @return mixed
* @throws \Magento\Framework\Exception
*/
public function create(ThemeInterface $theme)
{
if (!isset($this->_types[$theme->getType()])) {
throw new \Magento\Framework\Exception(sprintf('Invalid type of theme domain model "%s"', $theme->getType()));
}
$class = $this->_types[$theme->getType()];
return $this->_objectManager->create($class, ['theme' => $theme]);
}
开发者ID:shabbirvividads,项目名称:magento2,代码行数:15,代码来源:Factory.php
示例5: testToHtmlPreviewImageUrl
public function testToHtmlPreviewImageUrl()
{
/** @var $objectManager \Magento\TestFramework\ObjectManager */
$this->_theme->setType(\Magento\Framework\View\Design\ThemeInterface::TYPE_PHYSICAL);
$this->_theme->setPreviewImage('preview_image_test.jpg');
$this->_block->setArea('adminhtml');
$html = $this->_block->toHtml();
preg_match_all('/pub\\/static\\/adminhtml\\/_view\\/en_US/', $html, $result);
$this->assertEmpty($result[0]);
}
开发者ID:andrewhowdencom,项目名称:m2onk8s,代码行数:10,代码来源:GeneralTest.php
示例6: __construct
/**
* @param \Magento\Framework\View\DesignInterface $design
* @param \Magento\Framework\Filesystem $filesystem
* @param \Magento\Framework\Event\ManagerInterface $eventDispatcher
* @param \Magento\Framework\View\ConfigInterface $viewConfig
* @param \Magento\DesignEditor\Model\Config\Control\AbstractControl $configuration
* @param \Magento\Framework\View\Design\ThemeInterface $theme
* @param \Magento\Framework\View\Design\ThemeInterface $parentTheme
*/
public function __construct(\Magento\Framework\View\DesignInterface $design, \Magento\Framework\Filesystem $filesystem, \Magento\Framework\Event\ManagerInterface $eventDispatcher, \Magento\Framework\View\ConfigInterface $viewConfig, \Magento\DesignEditor\Model\Config\Control\AbstractControl $configuration = null, \Magento\Framework\View\Design\ThemeInterface $theme = null, \Magento\Framework\View\Design\ThemeInterface $parentTheme = null)
{
$this->_configuration = $configuration;
$this->_theme = $theme;
$this->_parentTheme = $parentTheme ?: $theme->getParentTheme();
$this->_design = $design;
$this->_filesystem = $filesystem;
$this->_eventDispatcher = $eventDispatcher;
$this->_viewConfigLoader = $viewConfig;
$this->_initViewConfigs()->_loadControlsData();
}
开发者ID:shabbirvividads,项目名称:magento2,代码行数:20,代码来源:Configuration.php
示例7: getFiles
/**
* Retrieve files
*
* @param ThemeInterface $theme
* @param string $filePath
* @return array|\Magento\Framework\View\File[]
*/
public function getFiles(ThemeInterface $theme, $filePath)
{
$themePath = $theme->getFullPath();
$files = $this->themesDirectory->search("{$themePath}/{$this->subDir}{$filePath}");
$result = [];
foreach ($files as $file) {
$filename = $this->themesDirectory->getAbsolutePath($file);
$result[] = $this->fileFactory->create($filename, null, $theme);
}
return $result;
}
开发者ID:shabbirvividads,项目名称:magento2,代码行数:18,代码来源:Theme.php
示例8: fetchUpdatesByHandle
/**
* Retrieve layout updates by handle
*
* @param string $handle
* @param \Magento\Framework\View\Design\ThemeInterface $theme
* @param \Magento\Framework\App\ScopeInterface $store
* @return string
*/
public function fetchUpdatesByHandle($handle, \Magento\Framework\View\Design\ThemeInterface $theme, \Magento\Framework\App\ScopeInterface $store)
{
$bind = ['layout_update_handle' => $handle, 'theme_id' => $theme->getId(), 'store_id' => $store->getId()];
$result = '';
$connection = $this->getConnection();
if ($connection) {
$select = $this->_getFetchUpdatesByHandleSelect();
$result = join('', $connection->fetchCol($select, $bind));
}
return $result;
}
开发者ID:tingyeeh,项目名称:magento2,代码行数:19,代码来源:Update.php
示例9: setup
public function setup()
{
$this->themeDirectoryMock = $this->getMockBuilder('Magento\\Framework\\Filesystem\\Directory\\ReadInterface')->getMock();
$this->fileFactoryMock = $this->getMockBuilder('Magento\\Framework\\View\\File\\Factory')->disableOriginalConstructor()->getMock();
$this->themeMock = $this->getMockBuilder('Magento\\Framework\\View\\Design\\ThemeInterface')->getMock();
$this->themeMock->expects($this->once())->method('getFullPath')->will($this->returnValue($this->themePath));
$this->readDirFactory = $this->getMock('Magento\\Framework\\Filesystem\\Directory\\ReadFactory', [], [], '', false);
$this->readDirFactory->expects($this->any())->method('create')->will($this->returnValue($this->themeDirectoryMock));
$this->componentRegistrar = $this->getMockForAbstractClass('Magento\\Framework\\Component\\ComponentRegistrarInterface');
$this->themeFileCollector = new Theme($this->fileFactoryMock, $this->readDirFactory, $this->componentRegistrar);
}
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:11,代码来源:ThemeTest.php
示例10: getFiles
/**
* Retrieve files
*
* @param \Magento\Framework\View\Design\ThemeInterface $theme
* @param string $filePath
* @return \Magento\Framework\View\File[]
*/
public function getFiles(ThemeInterface $theme, $filePath)
{
$result = [];
$sharedFiles = $this->componentDirSearch->collectFilesWithContext(ComponentRegistrar::MODULE, "view/base/{$this->subDir}{$filePath}");
foreach ($sharedFiles as $file) {
$result[] = $this->fileFactory->create($file->getFullPath(), $file->getComponentName(), null, true);
}
$area = $theme->getData('area');
$themeFiles = $this->componentDirSearch->collectFilesWithContext(ComponentRegistrar::MODULE, "view/{$area}/{$this->subDir}{$filePath}");
foreach ($themeFiles as $file) {
$result[] = $this->fileFactory->create($file->getFullPath(), $file->getComponentName());
}
return $result;
}
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:21,代码来源:Base.php
示例11: fetchUpdatesByHandle
/**
* Retrieve layout updates by handle
*
* @param string $handle
* @param \Magento\Framework\View\Design\ThemeInterface $theme
* @param \Magento\Framework\App\ScopeInterface $store
* @return string
*/
public function fetchUpdatesByHandle($handle, \Magento\Framework\View\Design\ThemeInterface $theme, \Magento\Framework\App\ScopeInterface $store)
{
$bind = ['theme_id' => $theme->getId(), 'store_id' => $store->getId()];
$cacheKey = implode('-', $bind);
if (!isset($this->layoutUpdateCache[$cacheKey])) {
$this->layoutUpdateCache[$cacheKey] = [];
foreach ($this->getConnection()->fetchAll($this->_getFetchUpdatesByHandleSelect(), $bind) as $layout) {
if (!isset($this->layoutUpdateCache[$cacheKey][$layout['handle']])) {
$this->layoutUpdateCache[$cacheKey][$layout['handle']] = '';
}
$this->layoutUpdateCache[$cacheKey][$layout['handle']] .= $layout['xml'];
}
}
return isset($this->layoutUpdateCache[$cacheKey][$handle]) ? $this->layoutUpdateCache[$cacheKey][$handle] : '';
}
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:23,代码来源:Update.php
示例12: _createStagingTheme
/**
* Create 'staging' theme associated with current 'virtual' theme
*
* @return \Magento\Framework\View\Design\ThemeInterface
*/
protected function _createStagingTheme()
{
$stagingTheme = $this->_themeFactory->create();
$stagingTheme->setData(['parent_id' => $this->_theme->getId(), 'theme_path' => null, 'theme_title' => sprintf('%s - Staging', $this->_theme->getThemeTitle()), 'preview_image' => $this->_theme->getPreviewImage(), 'is_featured' => $this->_theme->getIsFeatured(), 'type' => \Magento\Framework\View\Design\ThemeInterface::TYPE_STAGING]);
$stagingTheme->save();
return $stagingTheme;
}
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:12,代码来源:Virtual.php
示例13: update
/**
* Creates or updates custom single file which belong to a selected theme
*
* @param \Magento\Framework\View\Design\ThemeInterface $themeModel
* @param string $fileContent
* @return \Magento\Framework\View\Design\Theme\FileInterface
*/
public function update(\Magento\Framework\View\Design\ThemeInterface $themeModel, $fileContent)
{
$customFiles = $themeModel->getCustomization()->getFilesByType($this->_fileService->getType());
$customCss = reset($customFiles);
if (empty($fileContent) && $customCss) {
$customCss->delete();
return $customCss;
}
if (!$customCss) {
$customCss = $this->_fileService->create();
}
$customCss->setData('content', $fileContent);
$customCss->setTheme($themeModel);
$customCss->save();
return $customCss;
}
开发者ID:aiesh,项目名称:magento2,代码行数:23,代码来源:SingleFile.php
示例14: _addThemeFieldset
/**
* Add theme fieldset
*
* @param \Magento\Framework\Data\Form $form
* @param array $formData
* @param ThemeInterface $theme
* @return $this
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*/
protected function _addThemeFieldset($form, $formData, ThemeInterface $theme)
{
$themeFieldset = $form->addFieldset('theme', ['legend' => __('Theme Settings')]);
$this->_addElementTypes($themeFieldset);
if (isset($formData['theme_id'])) {
$themeFieldset->addField('theme_id', 'hidden', ['name' => 'theme_id']);
}
/** @var \Magento\Theme\Model\Theme\Collection $themesCollections */
$themesCollections = $this->_objectManager->create('Magento\\Theme\\Model\\Theme\\Collection');
/** @var \Magento\Framework\Json\Helper\Data $helper */
$helper = $this->_objectManager->get('Magento\\Framework\\Json\\Helper\\Data');
$onChangeScript = sprintf('parentThemeOnChange(this.value, %s)', str_replace('"', '\'', $helper->jsonEncode($this->_getDefaultsInherited($themesCollections->addDefaultPattern()))));
/** @var ThemeInterface $parentTheme */
$parentTheme = $this->_objectManager->create('Magento\\Framework\\View\\Design\\ThemeInterface');
if (!empty($formData['parent_id'])) {
$parentTheme->load($formData['parent_id']);
}
if ($this->_getCurrentTheme()->isObjectNew()) {
$themeFieldset->addField('parent_id', 'select', ['label' => __('Parent Theme'), 'title' => __('Parent Theme'), 'name' => 'parent_id', 'values' => $themesCollections->toOptionArray(!$parentTheme->getId()), 'required' => true, 'class' => 'no-changes', 'onchange' => $onChangeScript]);
} elseif (!empty($formData['parent_id'])) {
$themeFieldset->addField('parent_title', 'note', ['label' => __('Parent Theme'), 'title' => __('Parent Theme'), 'name' => 'parent_title', 'text' => $parentTheme->getId() ? $parentTheme->getThemeTitle() : '']);
}
if (!empty($formData['theme_path'])) {
$themeFieldset->addField('theme_path', 'label', ['label' => __('Theme Path'), 'title' => __('Theme Path'), 'name' => 'theme_code']);
}
$themeFieldset->addField('theme_title', $this->_getFieldTextType(), ['label' => __('Theme Title'), 'title' => __('Theme Title'), 'name' => 'theme_title', 'required' => $this->_isFieldAttrRequired()]);
if ($this->_isThemeEditable) {
$themeFieldset->addField('preview_image', 'image', ['label' => __('Theme Preview Image'), 'title' => __('Theme Preview Image'), 'name' => 'preview', 'required' => false, 'note' => $this->_getPreviewImageNote(), 'theme' => $theme]);
} elseif ($theme->hasPreviewImage()) {
$themeFieldset->addField('preview_image', 'note', ['label' => __('Theme Preview Image'), 'title' => __('Theme Preview Image'), 'name' => 'preview', 'after_element_html' => '<a href="' . $theme->getThemeImage()->getPreviewImageUrl() . '" onclick="imagePreview(\'theme_preview_image\'); return false;">' . '<img width="50" src="' . $theme->getThemeImage()->getPreviewImageUrl() . '" id="theme_preview_image" /></a>']);
}
return $this;
}
开发者ID:shabbirvividads,项目名称:magento2,代码行数:42,代码来源:General.php
示例15: assignToStore
/**
* Assign theme to the stores
*
* @param \Magento\Framework\View\Design\ThemeInterface $theme
* @param array $stores
* @param string $scope
* @return $this
*/
public function assignToStore($theme, array $stores = array(), $scope = \Magento\Store\Model\ScopeInterface::SCOPE_STORES)
{
$isReassigned = false;
$this->_unassignThemeFromStores($theme->getId(), $stores, $scope, $isReassigned);
if ($this->_storeManager->isSingleStoreMode()) {
$this->_assignThemeToDefaultScope($theme->getId(), $isReassigned);
} else {
$this->_assignThemeToStores($theme->getId(), $stores, $scope, $isReassigned);
}
if ($isReassigned) {
$this->_configCache->clean();
$this->_layoutCache->clean();
}
$this->_eventManager->dispatch('assign_theme_to_stores_after', array('stores' => $stores, 'scope' => $scope, 'theme' => $theme));
return $this;
}
开发者ID:aiesh,项目名称:magento2,代码行数:24,代码来源:Config.php
示例16: _configureToolbarBlocks
/**
* Pass data to the Toolbar panel blocks that is needed for rendering
*
* @param ThemeInterface $theme
* @param ThemeInterface $editableTheme
* @param string $mode
* @return $this
*/
protected function _configureToolbarBlocks($theme, $editableTheme, $mode)
{
/** @var $toolbarBlock \Magento\DesignEditor\Block\Adminhtml\Editor\Toolbar\Buttons */
$toolbarBlock = $this->_view->getLayout()->getBlock('design_editor_toolbar_buttons');
$toolbarBlock->setThemeId($editableTheme->getId())->setVirtualThemeId($theme->getId())->setMode($mode);
/** @var $saveButtonBlock \Magento\DesignEditor\Block\Adminhtml\Editor\Toolbar\Buttons\Save */
$saveButtonBlock = $this->_view->getLayout()->getBlock('design_editor_toolbar_buttons_save');
if ($saveButtonBlock) {
$saveButtonBlock->setTheme($theme)->setMode($mode)->setHasThemeAssigned($this->_customizationConfig->hasThemeAssigned());
}
/** @var $saveButtonBlock \Magento\DesignEditor\Block\Adminhtml\Editor\Toolbar\Buttons\Edit */
$editButtonBlock = $this->_view->getLayout()->getBlock('design_editor_toolbar_buttons_edit');
if ($editButtonBlock) {
$editButtonBlock->setTheme($editableTheme);
}
return $this;
}
开发者ID:nja78,项目名称:magento2,代码行数:25,代码来源:Launch.php
示例17: getFiles
/**
* Retrieve files
*
* @param \Magento\Framework\View\Design\ThemeInterface $theme
* @param string $filePath
* @return \Magento\Framework\View\File[]
*/
public function getFiles(ThemeInterface $theme, $filePath)
{
$namespace = $module = '*';
$themePath = $theme->getFullPath();
$files = $this->directory->search("{$themePath}/{$namespace}_{$module}/{$this->subDir}{$filePath}");
$result = [];
$pattern = "#/(?<moduleName>[^/]+)/{$this->subDir}"
. $this->pathPatternHelper->translatePatternFromGlob($filePath) . "$#i";
foreach ($files as $file) {
$filename = $this->directory->getAbsolutePath($file);
if (!preg_match($pattern, $filename, $matches)) {
continue;
}
$result[] = $this->fileFactory->create($filename, $matches['moduleName'], $theme);
}
return $result;
}
开发者ID:vasiljok,项目名称:magento2,代码行数:24,代码来源:ThemeModular.php
示例18: getFiles
/**
* Retrieve files
*
* @param ThemeInterface $theme
* @param string $filePath
* @return \Magento\Framework\View\File[]
* @throws \UnexpectedValueException
*/
public function getFiles(ThemeInterface $theme, $filePath)
{
$themePath = $theme->getFullPath();
if (empty($themePath)) {
return [];
}
$themeAbsolutePath = $this->componentRegistrar->getPath(ComponentRegistrar::THEME, $themePath);
if (!$themeAbsolutePath) {
return [];
}
$themeDir = $this->readDirFactory->create($themeAbsolutePath);
$files = $themeDir->search($this->subDir . $filePath);
$result = [];
foreach ($files as $file) {
$filename = $themeDir->getAbsolutePath($file);
$result[] = $this->fileFactory->create($filename, null, $theme);
}
return $result;
}
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:27,代码来源:Theme.php
示例19: getFiles
/**
* Retrieve files
*
* @param \Magento\Framework\View\Design\ThemeInterface $theme
* @param string $filePath
* @return \Magento\Framework\View\File[]
* @throws \Magento\Framework\Exception\LocalizedException
*/
public function getFiles(ThemeInterface $theme, $filePath)
{
$namespace = $module = '*';
$themePath = $theme->getFullPath();
$searchPattern = "{$themePath}/{$namespace}_{$module}/{$this->subDir}*/*/{$filePath}";
$files = $this->directory->search($searchPattern);
if (empty($files)) {
return [];
}
$themes = [];
$currentTheme = $theme;
while ($currentTheme = $currentTheme->getParentTheme()) {
$themes[$currentTheme->getCode()] = $currentTheme;
}
$result = [];
$pattern = "#/(?<module>[^/]+)/{$this->subDir}(?<themeVendor>[^/]+)/(?<themeName>[^/]+)/"
. $this->pathPatternHelper->translatePatternFromGlob($filePath) . "$#i";
foreach ($files as $file) {
$filename = $this->directory->getAbsolutePath($file);
if (!preg_match($pattern, $filename, $matches)) {
continue;
}
$moduleFull = $matches['module'];
$ancestorThemeCode = $matches['themeVendor'] . '/' . $matches['themeName'];
if (!isset($themes[$ancestorThemeCode])) {
throw new LocalizedException(
new \Magento\Framework\Phrase(
"Trying to override modular view file '%1' for theme '%2', which is not ancestor of theme '%3'",
[$filename, $ancestorThemeCode, $theme->getCode()]
)
);
}
$result[] = $this->fileFactory->create($filename, $moduleFull, $themes[$ancestorThemeCode]);
}
return $result;
}
开发者ID:vasiljok,项目名称:magento2,代码行数:46,代码来源:ThemeModular.php
示例20: testGetFiles
/**
*
* @dataProvider getFilesDataProvider
*
* @param $libraryFiles array Files in lib directory
* @param $baseFiles array Files in base directory
* @param $themeFiles array Files in theme
* *
* @return void
*/
public function testGetFiles($libraryFiles, $baseFiles, $themeFiles)
{
$this->fileListMock->expects($this->at(0))->method('add')->with($this->equalTo($libraryFiles));
$this->fileListMock->expects($this->at(1))->method('add')->with($this->equalTo($baseFiles));
$this->fileListMock->expects($this->any())->method('getAll')->will($this->returnValue(['returnedFile']));
$subPath = '*';
$this->libraryFilesMock->expects($this->atLeastOnce())->method('getFiles')->with($this->themeMock, $subPath)->will($this->returnValue($libraryFiles));
$this->baseFilesMock->expects($this->atLeastOnce())->method('getFiles')->with($this->themeMock, $subPath)->will($this->returnValue($baseFiles));
$this->overriddenBaseFilesMock->expects($this->any())->method('getFiles')->will($this->returnValue($themeFiles));
$aggregated = new Aggregated($this->fileListFactoryMock, $this->libraryFilesMock, $this->baseFilesMock, $this->overriddenBaseFilesMock, $this->loggerMock);
$inheritedThemeMock = $this->getMockBuilder('\\Magento\\Framework\\View\\Design\\ThemeInterface')->getMock();
$this->themeMock->expects($this->any())->method('getInheritedThemes')->will($this->returnValue([$inheritedThemeMock]));
$this->assertEquals(['returnedFile'], $aggregated->getFiles($this->themeMock, $subPath));
}
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:24,代码来源:AggregatedTest.php
注:本文中的Magento\Framework\View\Design\ThemeInterface类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论