Пример #1
0
 public function testGetFilesWrongAncestor()
 {
     $filePath = 'design/area/theme_path/Module_One/override/theme/vendor/parent_theme/1.xml';
     $this->setExpectedException('Magento\\Framework\\Exception', "Trying to override modular view file '{$filePath}' for theme 'vendor/parent_theme'" . ", which is not ancestor of theme 'vendor/theme_path'");
     $theme = $this->getMockForAbstractClass('Magento\\Framework\\View\\Design\\ThemeInterface');
     $theme->expects($this->once())->method('getFullPath')->will($this->returnValue('area/theme_path'));
     $theme->expects($this->once())->method('getParentTheme')->will($this->returnValue(null));
     $theme->expects($this->once())->method('getCode')->will($this->returnValue('vendor/theme_path'));
     $this->_directory->expects($this->once())->method('search')->with('area/theme_path/*_*/override/theme/*/*/*.xml')->will($this->returnValue([$filePath]));
     $this->_model->getFiles($theme, '*.xml');
 }
Пример #2
0
 public function testGetFilesWrongAncestor()
 {
     $themePath = 'area/theme_path';
     $inputPath = '*.xml';
     $filePath = 'design/area/theme_path/Module_One/override/theme/vendor/parent_theme/1.xml';
     $expectedMessage = "Trying to override modular view file '{$filePath}' for theme 'vendor/parent_theme'" . ", which is not ancestor of theme 'vendor/theme_path'";
     $this->setExpectedException('Magento\\Framework\\Exception\\LocalizedException', $expectedMessage);
     $theme = $this->getMockForAbstractClass('Magento\\Framework\\View\\Design\\ThemeInterface');
     $theme->expects($this->once())->method('getFullPath')->willReturn($themePath);
     $theme->expects($this->once())->method('getParentTheme')->willReturn(null);
     $theme->expects($this->once())->method('getCode')->willReturn('vendor/theme_path');
     $this->themeDirectory->expects($this->once())->method('search')->with('*_*/override/theme/*/*/*.xml')->willReturn([$filePath]);
     $this->pathPatternHelperMock->expects($this->any())->method('translatePatternFromGlob')->with($inputPath)->willReturn('[^/]*\\.xml');
     $this->componentRegistrar->expects($this->once())->method('getPath')->with(ComponentRegistrar::THEME, $themePath)->will($this->returnValue('/full/theme/path'));
     $this->model->getFiles($theme, $inputPath);
 }