/** * Copy customizations stored in a file system from one theme to another, overriding existing data * * @param ThemeInterface $source * @param ThemeInterface $target * @return void */ protected function _copyFilesystemCustomization(ThemeInterface $source, ThemeInterface $target) { $sourcePath = $this->_customizationPath->getCustomizationPath($source); $targetPath = $this->_customizationPath->getCustomizationPath($target); if (!$sourcePath || !$targetPath) { return; } $this->_deleteFilesRecursively($targetPath); if ($this->_directory->isDirectory($sourcePath)) { $this->_copyFilesRecursively($sourcePath, $sourcePath, $targetPath); } }
/** * Returns customization full path * * @param \Magento\Framework\View\Design\Theme\FileInterface $file * @return string */ public function getFullPath(\Magento\Framework\View\Design\Theme\FileInterface $file) { $customizationPath = $this->_customizationPath->getCustomizationPath($file->getTheme()); return $customizationPath . '/' . $file->getData('file_path'); }
/** * @covers \Magento\Framework\View\Design\Theme\Customization\Path::getCustomViewConfigPath */ public function testGetCustomViewConfigPath() { $expectedPath = implode('/', [\Magento\Framework\View\Design\Theme\Customization\Path::DIR_NAME, '123', \Magento\Framework\View\ConfigInterface::CONFIG_FILE_NAME]); $this->assertEquals($expectedPath, $this->_model->getCustomViewConfigPath($this->_theme->setId(123))); $this->assertNull($this->_model->getCustomViewConfigPath($this->_theme->setId(null))); }
/** * Get path to custom view configuration file * * @return null|string */ public function getCustomViewConfigPath() { return $this->customizationPath->getCustomViewConfigPath($this->theme); }
/** * @covers \Magento\Framework\View\Design\Theme\Customization\Path::getCustomViewConfigPath */ public function testGetCustomViewConfigPathNoId() { $this->_theme->expects($this->once())->method('getId')->will($this->returnValue(null)); $this->assertNull($this->_model->getCustomViewConfigPath($this->_theme)); }