diff --git a/module/CLI/src/Command/Tag/CreateTagCommand.php b/module/CLI/src/Command/Tag/CreateTagCommand.php index 40b28449..daf03d15 100644 --- a/module/CLI/src/Command/Tag/CreateTagCommand.php +++ b/module/CLI/src/Command/Tag/CreateTagCommand.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 CreateTagCommand extends Command @@ -45,19 +46,15 @@ class CreateTagCommand 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->createTags($tagNames); - $output->writeln($this->translator->translate('Created tags') . sprintf(': ["%s"]', implode( - '", "', - $tagNames - ))); + $io->success($this->translator->translate('Tags properly created')); } } diff --git a/module/CLI/test/Command/Tag/CreateTagCommandTest.php b/module/CLI/test/Command/Tag/CreateTagCommandTest.php index 6dab8d86..a81a2383 100644 --- a/module/CLI/test/Command/Tag/CreateTagCommandTest.php +++ b/module/CLI/test/Command/Tag/CreateTagCommandTest.php @@ -14,10 +14,6 @@ use Zend\I18n\Translator\Translator; class CreateTagCommandTest extends TestCase { - /** - * @var CreateTagCommand - */ - private $command; /** * @var CommandTester */ @@ -63,7 +59,7 @@ class CreateTagCommandTest extends TestCase ]); $output = $this->commandTester->getDisplay(); - $this->assertContains(sprintf('Created tags: ["%s"]', implode('", "', $tagNames)), $output); + $this->assertContains('Tags properly created', $output); $createTags->shouldHaveBeenCalled(); } }