public function testRunUninstallReadinessCheckWithError()
 {
     $packages = ['verndor/module' => 'magento2-module', 'verndor/theme' => 'magento2-theme', 'verndor/metapackage' => 'metapackage', 'verndor/language' => 'magento2-language'];
     $this->composerInfo->expects($this->once())->method('getRootRequiredPackageTypesByName')->willReturn($packages);
     $this->packageDependencyChecker->expects($this->once())->method('checkDependencies')->with(array_keys($packages))->willReturn([]);
     $this->themeDependencyChecker->expects($this->once())->method('checkChildThemeByPackagesName')->with(['verndor/theme'])->willReturn(['Error message']);
     $result = $this->uninstallDependencyCheck->runUninstallReadinessCheck(array_keys($packages));
     $this->assertEquals(['success' => false, 'error' => 'Error message'], $result);
 }
Пример #2
0
 public function testExecuteFailedDependencyCheck()
 {
     $this->setUpPassValidation();
     $this->setupPassThemeInUseCheck();
     $this->setupPassChildThemeCheck();
     $this->dependencyChecker->expects($this->once())->method('checkDependencies')->willReturn(['magento/theme-a' => ['magento/theme-b', 'magento/theme-c']]);
     $this->tester->execute(['theme' => ['frontend/Magento/a']]);
     $this->assertContains('Unable to uninstall. Please resolve the following issues:' . PHP_EOL . 'frontend/Magento/a has the following dependent package(s):' . PHP_EOL . "\tmagento/theme-b" . PHP_EOL . "\tmagento/theme-c", $this->tester->getDisplay());
 }
Пример #3
0
 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);
 }
 public function testExecutePackageNoLanguage()
 {
     $dependencies['vendor/language-ua_ua'] = [];
     $this->dependencyChecker->expects($this->once())->method('checkDependencies')->with(['vendor/language-ua_ua'])->willReturn($dependencies);
     $this->composerInfo->expects($this->once())->method('getRootRequiredPackagesAndTypes')->willReturn(['vendor/language-ua_ua' => 'library']);
     $this->remove->expects($this->never())->method('remove');
     $this->cache->expects($this->never())->method('clean');
     $this->tester->execute(['package' => ['vendor/language-ua_ua']]);
     $this->assertContains('Package vendor/language-ua_ua is not a Magento language and will be skipped', $this->tester->getDisplay());
     $this->assertContains('Nothing is removed.', $this->tester->getDisplay());
 }