diff --git a/module/CLI/src/Command/Tag/DeleteTagsCommand.php b/module/CLI/src/Command/Tag/DeleteTagsCommand.php index 0654138b..5da57ede 100644 --- a/module/CLI/src/Command/Tag/DeleteTagsCommand.php +++ b/module/CLI/src/Command/Tag/DeleteTagsCommand.php @@ -8,6 +8,7 @@ use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; +use Symfony\Component\Console\Style\SymfonyStyle; use Zend\I18n\Translator\TranslatorInterface; class DeleteTagsCommand extends Command @@ -45,19 +46,15 @@ class DeleteTagsCommand extends Command protected function execute(InputInterface $input, OutputInterface $output) { + $io = new SymfonyStyle($input, $output); $tagNames = $input->getOption('name'); + if (empty($tagNames)) { - $output->writeln(sprintf( - '%s', - $this->translator->translate('You have to provide at least one tag name') - )); + $io->warning($this->translator->translate('You have to provide at least one tag name')); return; } $this->tagService->deleteTags($tagNames); - $output->writeln($this->translator->translate('Deleted tags') . sprintf(': ["%s"]', implode( - '", "', - $tagNames - ))); + $io->success($this->translator->translate('Tags properly deleted')); } } diff --git a/module/CLI/test/Command/Tag/DeleteTagsCommandTest.php b/module/CLI/test/Command/Tag/DeleteTagsCommandTest.php index b8f58ff7..819342c9 100644 --- a/module/CLI/test/Command/Tag/DeleteTagsCommandTest.php +++ b/module/CLI/test/Command/Tag/DeleteTagsCommandTest.php @@ -64,7 +64,7 @@ class DeleteTagsCommandTest extends TestCase ]); $output = $this->commandTester->getDisplay(); - $this->assertContains(sprintf('Deleted tags: ["%s"]', implode('", "', $tagNames)), $output); + $this->assertContains('Tags properly deleted', $output); $deleteTags->shouldHaveBeenCalled(); } }