Skip to content

Commit 908e46d

Browse files
Fred Sungeddielau
authored andcommitted
MAGETWO-38180: Check if the theme is not a base for any virtual theme
- Remove the deployment configuration check since this command belongs to module. It won't show up in the command list unless you installed it.
1 parent c7a0c7f commit 908e46d

File tree

2 files changed

+0
-39
lines changed

2 files changed

+0
-39
lines changed

app/code/Magento/Theme/Console/Command/ThemeUninstallCommand.php

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
use Symfony\Component\Console\Output\OutputInterface;
2222
use Symfony\Component\Console\Input\InputOption;
2323
use Symfony\Component\Console\Input\InputArgument;
24-
use Magento\Framework\App\DeploymentConfig;
2524
use Magento\Framework\Setup\BackupRollbackFactory;
2625
use Magento\Framework\App\Filesystem\DirectoryList;
2726
use Magento\Framework\Exception\LocalizedException;
@@ -41,13 +40,6 @@ class ThemeUninstallCommand extends Command
4140
const INPUT_KEY_THEMES = 'theme';
4241
const INPUT_KEY_CLEAR_STATIC_CONTENT = 'clear-static-content';
4342

44-
/**
45-
* Deployment Configuration
46-
*
47-
* @var DeploymentConfig
48-
*/
49-
private $deploymentConfig;
50-
5143
/**
5244
* Maintenance Mode
5345
*
@@ -131,7 +123,6 @@ class ThemeUninstallCommand extends Command
131123
* @param Cache $cache
132124
* @param State\CleanupFiles $cleanupFiles
133125
* @param ComposerInformation $composer
134-
* @param DeploymentConfig $deploymentConfig
135126
* @param MaintenanceMode $maintenanceMode
136127
* @param Filesystem $filesystem
137128
* @param DependencyChecker $dependencyChecker
@@ -146,7 +137,6 @@ public function __construct(
146137
Cache $cache,
147138
State\CleanupFiles $cleanupFiles,
148139
ComposerInformation $composer,
149-
DeploymentConfig $deploymentConfig,
150140
MaintenanceMode $maintenanceMode,
151141
Filesystem $filesystem,
152142
DependencyChecker $dependencyChecker,
@@ -159,7 +149,6 @@ public function __construct(
159149
$this->cache = $cache;
160150
$this->cleanupFiles = $cleanupFiles;
161151
$this->composer = $composer;
162-
$this->deploymentConfig = $deploymentConfig;
163152
$this->maintenanceMode = $maintenanceMode;
164153
$this->filesystem = $filesystem;
165154
$this->dependencyChecker = $dependencyChecker;
@@ -205,13 +194,6 @@ protected function configure()
205194
*/
206195
protected function execute(InputInterface $input, OutputInterface $output)
207196
{
208-
if (!$this->deploymentConfig->isAvailable()) {
209-
$output->writeln(
210-
'<error>You cannot run this command because the Magento application is not installed.</error>'
211-
);
212-
return;
213-
}
214-
215197
$themePaths = $input->getArgument(self::INPUT_KEY_THEMES);
216198
$validationMessages = $this->validate($themePaths);
217199
if (!empty($validationMessages)) {

app/code/Magento/Theme/Test/Unit/Console/Command/ThemeUninstallCommandTest.php

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,6 @@
1616
*/
1717
class ThemeUninstallCommandTest extends \PHPUnit_Framework_TestCase
1818
{
19-
/**
20-
* @var \Magento\Framework\App\DeploymentConfig|\PHPUnit_Framework_MockObject_MockObject
21-
*/
22-
private $deploymentConfig;
23-
2419
/**
2520
* @var \Magento\Framework\App\MaintenanceMode|\PHPUnit_Framework_MockObject_MockObject
2621
*/
@@ -78,7 +73,6 @@ class ThemeUninstallCommandTest extends \PHPUnit_Framework_TestCase
7873

7974
public function setUp()
8075
{
81-
$this->deploymentConfig = $this->getMock('Magento\Framework\App\DeploymentConfig', [], [], '', false);
8276
$this->maintenanceMode = $this->getMock('Magento\Framework\App\MaintenanceMode', [], [], '', false);
8377
$composerInformation = $this->getMock('Magento\Framework\Composer\ComposerInformation', [], [], '', false);
8478
$composerInformation->expects($this->any())
@@ -109,7 +103,6 @@ public function setUp()
109103
$this->cache,
110104
$this->cleanupFiles,
111105
$composerInformation,
112-
$this->deploymentConfig,
113106
$this->maintenanceMode,
114107
$this->filesystem,
115108
$this->dependencyChecker,
@@ -122,19 +115,8 @@ public function setUp()
122115
$this->tester = new CommandTester($this->command);
123116
}
124117

125-
public function testExecuteWithoutApplicationInstalled()
126-
{
127-
$this->deploymentConfig->expects($this->once())->method('isAvailable')->willReturn(false);
128-
$this->tester->execute(['theme' => ['test']]);
129-
$this->assertContains(
130-
'You cannot run this command because the Magento application is not installed.',
131-
$this->tester->getDisplay()
132-
);
133-
}
134-
135118
public function testExecuteFailedValidationNotPackage()
136119
{
137-
$this->deploymentConfig->expects($this->once())->method('isAvailable')->willReturn(true);
138120
$dirRead = $this->getMock('Magento\Framework\Filesystem\Directory\Read', [], [], '', false);
139121
// package name "dummy" is not in root composer.json file
140122
$dirRead->expects($this->any())
@@ -167,7 +149,6 @@ public function testExecuteFailedValidationNotPackage()
167149

168150
public function testExecuteFailedValidationNotTheme()
169151
{
170-
$this->deploymentConfig->expects($this->once())->method('isAvailable')->willReturn(true);
171152
$dirRead = $this->getMock('Magento\Framework\Filesystem\Directory\Read', [], [], '', false);
172153
$dirRead->expects($this->any())->method('isExist')->willReturn(false);
173154
$this->filesystem->expects($this->any())
@@ -187,7 +168,6 @@ public function testExecuteFailedValidationNotTheme()
187168

188169
public function testExecuteFailedValidationMixed()
189170
{
190-
$this->deploymentConfig->expects($this->once())->method('isAvailable')->willReturn(true);
191171
$dirRead = $this->getMock('Magento\Framework\Filesystem\Directory\Read', [], [], '', false);
192172
// package name "dummy" is not in root composer.json file
193173
$dirRead->expects($this->any())
@@ -237,7 +217,6 @@ public function testExecuteFailedValidationMixed()
237217

238218
public function setUpPassValidation()
239219
{
240-
$this->deploymentConfig->expects($this->once())->method('isAvailable')->willReturn(true);
241220
$dirRead = $this->getMock('Magento\Framework\Filesystem\Directory\Read', [], [], '', false);
242221
// package name "dummy" is not in root composer.json file
243222
$dirRead->expects($this->any())

0 commit comments

Comments
 (0)