16 private $themeDependencyChecker;
21 private $themeCollection;
26 private $themeProvider;
31 private $themePackageInfo;
35 $this->themePackageInfo = $this->createMock(\
Magento\
Theme\Model\
Theme\ThemePackageInfo::class);
37 $this->themeProvider = $this->createMock(\
Magento\
Theme\Model\
Theme\ThemeProvider::class);
40 $this->themeCollection,
42 $this->themePackageInfo
52 $this->themePackageInfo->expects($this->exactly(2))->method(
'getFullThemePath')->willReturn(
null);
53 $this->themeDependencyChecker->checkChildThemeByPackagesName($packages);
67 $theme->expects($this->any())->method(
'hasChildThemes')->willReturn($hasVirtual);
68 $parentThemeA = $this->createMock(\
Magento\
Theme\Model\Theme::class);
69 $parentThemeA->expects($this->any())->method(
'getFullPath')->willReturn(
'frontend/Magento/a');
70 $parentThemeB = $this->createMock(\
Magento\
Theme\Model\Theme::class);
71 $parentThemeB->expects($this->any())->method(
'getFullPath')->willReturn(
'frontend/Magento/b');
72 $childThemeC = $this->createMock(\
Magento\
Theme\Model\Theme::class);
73 $childThemeC->expects($this->any())->method(
'getFullPath')->willReturn(
'frontend/Magento/c');
74 $childThemeD = $this->createMock(\
Magento\
Theme\Model\Theme::class);
75 $childThemeD->expects($this->any())->method(
'getFullPath')->willReturn(
'frontend/Magento/d');
78 $childThemeC->expects($this->any())->method(
'getParentTheme')->willReturn($parentThemeA);
79 $childThemeD->expects($this->any())->method(
'getParentTheme')->willReturn($parentThemeB);
82 $this->themeProvider->expects($this->any())->method(
'getThemeByFullPath')->willReturn(
$theme);
83 $this->themeCollection->expects($this->any())
84 ->method(
'getIterator')
85 ->willReturn(
new \ArrayIterator([$childThemeC, $childThemeD]));
87 $this->assertEquals($expected, $this->themeDependencyChecker->checkChildTheme($input));
99 [
'frontend/Magento/a'],
100 [
'frontend/Magento/a is a parent of virtual theme. Parent themes cannot be uninstalled.']
105 [
'frontend/Magento/a',
'frontend/Magento/b'],
106 [
'frontend/Magento/a, frontend/Magento/b are parents of virtual theme.' 107 .
' Parent themes cannot be uninstalled.']
112 [
'frontend/Magento/a'],
113 [
'frontend/Magento/a is a parent of physical theme. Parent themes cannot be uninstalled.']
118 [
'frontend/Magento/a',
'frontend/Magento/b'],
119 [
'frontend/Magento/a, frontend/Magento/b are parents of physical theme.' 120 .
' Parent themes cannot be uninstalled.']
125 [
'frontend/Magento/a'],
126 [
'frontend/Magento/a is a parent of virtual theme. Parent themes cannot be uninstalled.',
127 'frontend/Magento/a is a parent of physical theme. Parent themes cannot be uninstalled.']
132 [
'frontend/Magento/a',
'frontend/Magento/b'],
133 [
'frontend/Magento/a, frontend/Magento/b are parents of virtual theme.' 134 .
' Parent themes cannot be uninstalled.',
135 'frontend/Magento/a, frontend/Magento/b are parents of physical theme.' 136 .
' Parent themes cannot be uninstalled.']
executeFailedChildThemeCheckDataProvider()
testCheckChildThemeByPackagesName()
testExecuteFailedChildThemeCheck($hasVirtual, $hasPhysical, array $input, $expected)