Skip to content

Commit d9aca35

Browse files
author
Fred Sung
committed
MAGETWO-38833: Fix error message format inconsistency in theme uninstall command
- Rephrase error messages.
1 parent 89c3bde commit d9aca35

File tree

2 files changed

+26
-20
lines changed

2 files changed

+26
-20
lines changed

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
209209
);
210210
if (!empty($messages)) {
211211
$output->writeln(
212-
'<error>Unable to uninstall. Please fix the following issues:</error>'
212+
'<error>Unable to uninstall. Please resolve the following issues:</error>'
213213
. PHP_EOL . implode(PHP_EOL, $messages)
214214
);
215215
return;
@@ -290,7 +290,7 @@ private function checkDependencies($themePaths)
290290
if (!empty($dependingPackages)) {
291291
$messages[] =
292292
'<error>' . $packageToPath[$package] .
293-
" has the following package(s) depend on it:</error>" .
293+
" has the following dependent package(s):</error>" .
294294
PHP_EOL . "\t<error>" . implode('</error>' . PHP_EOL . "\t<error>", $dependingPackages)
295295
. "</error>";
296296
}
@@ -321,11 +321,13 @@ private function checkChildTheme($themePaths)
321321
}
322322
if (!empty($themeHasVirtualChildren)) {
323323
$text = count($themeHasVirtualChildren) > 1 ? ' are parents of' : ' is a parent of';
324-
$messages[] = '<error>' . implode(', ', $themeHasVirtualChildren) . $text . ' virtual theme</error>';
324+
$messages[] = '<error>' . implode(', ', $themeHasVirtualChildren) . $text . ' virtual theme.'
325+
. ' Parent themes cannot be uninstalled.</error>';
325326
}
326327
if (!empty($themeHasPhysicalChildren)) {
327328
$text = count($themeHasPhysicalChildren) > 1 ? ' are parents of' : ' is a parent of';
328-
$messages[] = '<error>' . implode(', ', $themeHasPhysicalChildren) . $text . ' physical theme</error>';
329+
$messages[] = '<error>' . implode(', ', $themeHasPhysicalChildren) . $text . ' physical theme.'
330+
. ' Parent themes cannot be uninstalled.</error>';
329331
}
330332
return $messages;
331333
}

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

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ public function testExecuteFailedThemeInUseCheck()
271271
->willReturn(['frontend/Magento/a is in use in default config']);
272272
$this->tester->execute(['theme' => ['frontend/Magento/a']]);
273273
$this->assertEquals(
274-
'Unable to uninstall. Please fix the following issues:' . PHP_EOL
274+
'Unable to uninstall. Please resolve the following issues:' . PHP_EOL
275275
. 'frontend/Magento/a is in use in default config' . PHP_EOL,
276276
$this->tester->getDisplay()
277277
);
@@ -324,44 +324,48 @@ public function executeFailedChildThemeCheckDataProvider()
324324
true,
325325
false,
326326
['theme' => ['frontend/Magento/a']],
327-
'Unable to uninstall. Please fix the following issues:' . PHP_EOL
328-
. 'frontend/Magento/a is a parent of virtual theme'
327+
'Unable to uninstall. Please resolve the following issues:' . PHP_EOL
328+
. 'frontend/Magento/a is a parent of virtual theme. Parent themes cannot be uninstalled.'
329329
],
330330
[
331331
true,
332332
false,
333333
['theme' => ['frontend/Magento/a', 'frontend/Magento/b']],
334-
'Unable to uninstall. Please fix the following issues:' . PHP_EOL .
335-
'frontend/Magento/a, frontend/Magento/b are parents of virtual theme'
334+
'Unable to uninstall. Please resolve the following issues:' . PHP_EOL .
335+
'frontend/Magento/a, frontend/Magento/b are parents of virtual theme.'
336+
. ' Parent themes cannot be uninstalled.'
336337
],
337338
[
338339
false,
339340
true,
340341
['theme' => ['frontend/Magento/a']],
341-
'Unable to uninstall. Please fix the following issues:' . PHP_EOL .
342-
'frontend/Magento/a is a parent of physical theme'
342+
'Unable to uninstall. Please resolve the following issues:' . PHP_EOL .
343+
'frontend/Magento/a is a parent of physical theme. Parent themes cannot be uninstalled.'
343344
],
344345
[
345346
false,
346347
true,
347348
['theme' => ['frontend/Magento/a', 'frontend/Magento/b']],
348-
'Unable to uninstall. Please fix the following issues:' . PHP_EOL .
349-
'frontend/Magento/a, frontend/Magento/b are parents of physical theme'
349+
'Unable to uninstall. Please resolve the following issues:' . PHP_EOL .
350+
'frontend/Magento/a, frontend/Magento/b are parents of physical theme.'
351+
. ' Parent themes cannot be uninstalled.'
350352
],
351353
[
352354
true,
353355
true,
354356
['theme' => ['frontend/Magento/a']],
355-
'Unable to uninstall. Please fix the following issues:' . PHP_EOL .
356-
'frontend/Magento/a is a parent of virtual theme' . PHP_EOL .
357-
'frontend/Magento/a is a parent of physical theme'
357+
'Unable to uninstall. Please resolve the following issues:' . PHP_EOL .
358+
'frontend/Magento/a is a parent of virtual theme. Parent themes cannot be uninstalled.' . PHP_EOL .
359+
'frontend/Magento/a is a parent of physical theme. Parent themes cannot be uninstalled.'
358360
],
359361
[
360362
true,
361363
true,
362364
['theme' => ['frontend/Magento/a', 'frontend/Magento/b']],
363-
'frontend/Magento/a, frontend/Magento/b are parents of virtual theme' . PHP_EOL .
364-
'frontend/Magento/a, frontend/Magento/b are parents of physical theme'
365+
'frontend/Magento/a, frontend/Magento/b are parents of virtual theme.'
366+
. ' Parent themes cannot be uninstalled.' . PHP_EOL .
367+
'frontend/Magento/a, frontend/Magento/b are parents of physical theme.'
368+
. ' Parent themes cannot be uninstalled.'
365369
],
366370
];
367371
}
@@ -376,8 +380,8 @@ public function testExecuteFailedDependencyCheck()
376380
->willReturn(['magento/theme-a' => ['magento/theme-b', 'magento/theme-c']]);
377381
$this->tester->execute(['theme' => ['frontend/Magento/a']]);
378382
$this->assertContains(
379-
'Unable to uninstall. Please fix the following issues:' . PHP_EOL .
380-
'frontend/Magento/a has the following package(s) depend on it:'
383+
'Unable to uninstall. Please resolve the following issues:' . PHP_EOL .
384+
'frontend/Magento/a has the following dependent package(s):'
381385
. PHP_EOL . "\tmagento/theme-b" . PHP_EOL . "\tmagento/theme-c",
382386
$this->tester->getDisplay()
383387
);

0 commit comments

Comments
 (0)