/**
  * @covers \Magento\Theme\Model\Config\Customization::isThemeAssignedToStore
  */
 public function testIsThemeAssignedToDefaultStore()
 {
     $this->storeManager->expects($this->once())->method('getStores')->willReturn([$this->getStore()]);
     $this->designPackage->expects($this->once())->method('getConfigurationDesignTheme')->willReturn($this->getAssignedTheme()->getId());
     $this->themeProviderMock->expects($this->once())->method('getThemeCustomizations')->with(Area::AREA_FRONTEND)->willReturn([$this->getAssignedTheme(), $this->getUnassignedTheme()]);
     $themeAssigned = $this->model->isThemeAssignedToStore($this->getAssignedTheme());
     $this->assertEquals(true, $themeAssigned);
 }
 public function testUninstallCode()
 {
     $this->output->expects($this->atLeastOnce())->method('writeln');
     $this->themePackageInfo->expects($this->at(0))->method('getPackageName')->willReturn('packageA');
     $this->themePackageInfo->expects($this->at(1))->method('getPackageName')->willReturn('packageB');
     $this->themePackageInfo->expects($this->at(2))->method('getPackageName')->willReturn('packageC');
     $this->remove->expects($this->once())->method('remove')->with(['packageA', 'packageB', 'packageC'])->willReturn('');
     $this->themeProvider->expects($this->never())->method($this->anything());
     $this->themeUninstaller->uninstallCode($this->output, ['frontend/Magento/ThemeA', 'frontend/Magento/ThemeB', 'frontend/Magento/ThemeC']);
 }
 public function setUpExecute()
 {
     $this->setUpPassValidation();
     $this->setupPassChildThemeCheck();
     $this->dependencyChecker->expects($this->once())->method('checkDependencies')->willReturn([]);
     $this->remove->expects($this->once())->method('remove');
     $this->cache->expects($this->once())->method('clean');
     $theme = $this->getMock('Magento\\Theme\\Model\\Theme', [], [], '', false);
     $this->themeProvider->expects($this->any())->method('getThemeByFullPath')->willReturn($theme);
 }
 /**
  * @dataProvider executeFailedChildThemeCheckDataProvider
  * @param bool $hasVirtual
  * @param bool $hasPhysical
  * @param array $input
  * @param string $expected
  * @return void
  */
 public function testExecuteFailedChildThemeCheck($hasVirtual, $hasPhysical, array $input, $expected)
 {
     $theme = $this->getMock('Magento\\Theme\\Model\\Theme', [], [], '', false);
     $theme->expects($this->any())->method('hasChildThemes')->willReturn($hasVirtual);
     $parentThemeA = $this->getMock('Magento\\Theme\\Model\\Theme', [], [], '', false);
     $parentThemeA->expects($this->any())->method('getFullPath')->willReturn('frontend/Magento/a');
     $parentThemeB = $this->getMock('Magento\\Theme\\Model\\Theme', [], [], '', false);
     $parentThemeB->expects($this->any())->method('getFullPath')->willReturn('frontend/Magento/b');
     $childThemeC = $this->getMock('Magento\\Theme\\Model\\Theme', [], [], '', false);
     $childThemeC->expects($this->any())->method('getFullPath')->willReturn('frontend/Magento/c');
     $childThemeD = $this->getMock('Magento\\Theme\\Model\\Theme', [], [], '', false);
     $childThemeD->expects($this->any())->method('getFullPath')->willReturn('frontend/Magento/d');
     if ($hasPhysical) {
         $childThemeC->expects($this->any())->method('getParentTheme')->willReturn($parentThemeA);
         $childThemeD->expects($this->any())->method('getParentTheme')->willReturn($parentThemeB);
     }
     $this->themeProvider->expects($this->any())->method('getThemeByFullPath')->willReturn($theme);
     $this->themeCollection->expects($this->any())->method('getIterator')->willReturn(new \ArrayIterator([$childThemeC, $childThemeD]));
     $this->assertEquals($expected, $this->themeDependencyChecker->checkChildTheme($input));
 }