public function testGetPatternDirs() { $parentTheme = $this->getMockForAbstractClass('Magento\\Framework\\View\\Design\\ThemeInterface'); $parentTheme->expects($this->any())->method('getFullPath')->will($this->returnValue('package/parent_theme')); $theme = $this->getMockForAbstractClass('Magento\\Framework\\View\\Design\\ThemeInterface'); $theme->expects($this->any())->method('getFullPath')->will($this->returnValue('package/current_theme')); $theme->expects($this->any())->method('getParentTheme')->will($this->returnValue($parentTheme)); $this->componentRegistrar->expects($this->any())->method('getPath')->will($this->returnValueMap([[ComponentRegistrar::THEME, 'package/parent_theme', '/path/to/parent/theme'], [ComponentRegistrar::THEME, 'package/current_theme', '/path/to/current/theme']])); $ruleDirsMap = [[['theme_dir' => '/path/to/current/theme'], ['package/current_theme/path/one', 'package/current_theme/path/two']], [['theme_dir' => '/path/to/parent/theme'], ['package/parent_theme/path/one', 'package/parent_theme/path/two']]]; $this->rule->expects($this->any())->method('getPatternDirs')->will($this->returnValueMap($ruleDirsMap)); $expectedResult = ['package/current_theme/path/one', 'package/current_theme/path/two', 'package/parent_theme/path/one', 'package/parent_theme/path/two']; $this->assertEquals($expectedResult, $this->model->getPatternDirs(['theme' => $theme])); }
public function testGetPatternDirs() { $parentTheme = $this->getMockForAbstractClass('Magento\\Framework\\View\\Design\\ThemeInterface'); $parentTheme->expects($this->any())->method('getThemePath')->will($this->returnValue('package/parent_theme')); $theme = $this->getMockForAbstractClass('Magento\\Framework\\View\\Design\\ThemeInterface'); $theme->expects($this->any())->method('getThemePath')->will($this->returnValue('package/current_theme')); $theme->expects($this->any())->method('getParentTheme')->will($this->returnValue($parentTheme)); $ruleDirsMap = [[['theme_path' => 'package/current_theme'], ['package/current_theme/path/one', 'package/current_theme/path/two']], [['theme_path' => 'package/parent_theme'], ['package/parent_theme/path/one', 'package/parent_theme/path/two']]]; $rule = $this->getMockForAbstractClass('Magento\\Framework\\View\\Design\\Fallback\\Rule\\RuleInterface'); $rule->expects($this->any())->method('getPatternDirs')->will($this->returnValueMap($ruleDirsMap)); /** @var $rule RuleInterface */ $object = new Theme($rule); $expectedResult = ['package/current_theme/path/one', 'package/current_theme/path/two', 'package/parent_theme/path/one', 'package/parent_theme/path/two']; $this->assertEquals($expectedResult, $object->getPatternDirs(['theme' => $theme])); }