From 7bbaf63119aa1ea817d118a26fed48918366c8c8 Mon Sep 17 00:00:00 2001 From: Eddie Lau <kahlau@ebay.com> Date: Thu, 23 Apr 2015 14:06:37 -0500 Subject: [PATCH] MAGETWO-36074: Move dev/tools/Magento/Tools/I18n/generator.php - made changes according to CR --- .../Command/I18nCollectPhrasesCommandTest.php | 6 +++-- .../Command/I18nCollectPhrasesCommand.php | 25 ++++++++----------- 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/dev/tests/integration/testsuite/Magento/Setup/Console/Command/I18nCollectPhrasesCommandTest.php b/dev/tests/integration/testsuite/Magento/Setup/Console/Command/I18nCollectPhrasesCommandTest.php index ca779cf78d6..924853df6bc 100644 --- a/dev/tests/integration/testsuite/Magento/Setup/Console/Command/I18nCollectPhrasesCommandTest.php +++ b/dev/tests/integration/testsuite/Magento/Setup/Console/Command/I18nCollectPhrasesCommandTest.php @@ -61,6 +61,10 @@ class I18nCollectPhrasesCommandTest extends \PHPUnit_Framework_TestCase unlink($outputPath); } + /** + * @expectedException \InvalidArgumentException + * @expectedExceptionMessage Specified path doesn't exist + */ public function testExecuteNonExistingPath() { $this->tester->execute( @@ -68,7 +72,5 @@ class I18nCollectPhrasesCommandTest extends \PHPUnit_Framework_TestCase 'directory' => BP . '/dev/tests/integration/testsuite/Magento/Setup/Console/Command/_files/non_exist', ] ); - - $this->assertEquals("Specified path doesn't exist" . PHP_EOL, $this->tester->getDisplay()); } } diff --git a/setup/src/Magento/Setup/Console/Command/I18nCollectPhrasesCommand.php b/setup/src/Magento/Setup/Console/Command/I18nCollectPhrasesCommand.php index 63ce240d56a..afb277dab80 100644 --- a/setup/src/Magento/Setup/Console/Command/I18nCollectPhrasesCommand.php +++ b/setup/src/Magento/Setup/Console/Command/I18nCollectPhrasesCommand.php @@ -35,18 +35,19 @@ class I18nCollectPhrasesCommand extends Command $this->setName('i18n:collect-phrases') ->setDescription('Discovers phrases in the codebase'); $this->setDefinition([ - new InputArgument(self::INPUT_KEY_DIRECTORY, InputArgument::REQUIRED, 'Path to a directory to parse'), + new InputArgument(self::INPUT_KEY_DIRECTORY, InputArgument::REQUIRED, 'Directory path to parse'), new InputOption( self::INPUT_KEY_OUTPUT, self::SHORTCUT_KEY_OUTPUT, InputOption::VALUE_REQUIRED, - 'Path (with filename) to output file, by default output the results into standard output stream' + 'Path (including filename) to an output file. With no file specified, defaults to stdout.' ), new InputOption( self::INPUT_KEY_MAGENTO, self::SHORTCUT_KEY_MAGENTO, InputOption::VALUE_NONE, - 'Flag indicates whether the specified "directory" path is a Magento root directory, false by default' + 'Use the --magento parameter to specify the directory is the Magento root directory.' . + ' Omit the parameter if the directory is not the Magento root directory.' ), ]); } @@ -56,16 +57,12 @@ class I18nCollectPhrasesCommand extends Command */ protected function execute(InputInterface $input, OutputInterface $output) { - try { - $generator = ServiceLocator::getDictionaryGenerator(); - $generator->generate( - $input->getArgument(self::INPUT_KEY_DIRECTORY), - $input->getOption(self::INPUT_KEY_OUTPUT), - $input->getOption(self::INPUT_KEY_MAGENTO) - ); - $output->writeln('Dictionary successfully processed.'); - } catch (\Exception $e) { - $output->writeln($e->getMessage()); - } + $generator = ServiceLocator::getDictionaryGenerator(); + $generator->generate( + $input->getArgument(self::INPUT_KEY_DIRECTORY), + $input->getOption(self::INPUT_KEY_OUTPUT), + $input->getOption(self::INPUT_KEY_MAGENTO) + ); + $output->writeln('<info>Dictionary successfully processed.</info>'); } } -- GitLab