Ejemplo n.º 1
0
 /**
  * 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);
     }
 }
Ejemplo n.º 2
0
 /**
  * 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');
 }
Ejemplo n.º 3
0
 /**
  * @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)));
 }
Ejemplo n.º 4
0
 /**
  * Get path to custom view configuration file
  *
  * @return null|string
  */
 public function getCustomViewConfigPath()
 {
     return $this->customizationPath->getCustomViewConfigPath($this->theme);
 }
Ejemplo n.º 5
0
 /**
  * @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));
 }