protected function setUp() { $this->testDir = realpath(__DIR__ . '/_files'); $this->expectedDir = $this->testDir . '/expected'; $this->source = $this->testDir . '/source'; $this->outputFileName = $this->testDir . '/translate.csv'; $this->generator = ServiceLocator::getDictionaryGenerator(); }
/** * {@inheritdoc} */ protected function execute(InputInterface $input, OutputInterface $output) { $directory = $input->getArgument(self::INPUT_KEY_DIRECTORY); if ($input->getOption(self::INPUT_KEY_MAGENTO)) { $directory = BP; if ($input->getArgument(self::INPUT_KEY_DIRECTORY)) { throw new \InvalidArgumentException('Directory path is not needed when --magento flag is set.'); } } elseif (!$input->getArgument(self::INPUT_KEY_DIRECTORY)) { throw new \InvalidArgumentException('Directory path is needed when --magento flag is not set.'); } $generator = ServiceLocator::getDictionaryGenerator(); $generator->generate($directory, $input->getOption(self::INPUT_KEY_OUTPUT), $input->getOption(self::INPUT_KEY_MAGENTO)); $output->writeln('<info>Dictionary successfully processed.</info>'); }
protected function setUp() { $reflection = new \ReflectionClass('Magento\\Framework\\Component\\ComponentRegistrar'); $paths = $reflection->getProperty('paths'); $paths->setAccessible(true); $this->backupRegistrar = $paths->getValue(); $paths->setAccessible(false); $this->testDir = realpath(__DIR__ . '/_files'); $this->expectedDir = $this->testDir . '/expected'; $this->source = $this->testDir . '/source'; $this->outputFileName = $this->testDir . '/translate.csv'; // Register the test modules ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_FirstModule', $this->source . '/app/code/Magento/FirstModule'); ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_SecondModule', $this->source . '/app/code/Magento/SecondModule'); // Register the test theme ComponentRegistrar::register(ComponentRegistrar::THEME, 'adminhtml/default/backend', $this->source . '/app/design/adminhtml/default/backend'); $this->generator = ServiceLocator::getDictionaryGenerator(); }
/** * {@inheritdoc} */ protected function execute(InputInterface $input, OutputInterface $output) { $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>'); }