/**
  * Shows necessary information for installing Magento
  *
  * @return string
  * @throws \InvalidArgumentException
  */
 public function helpAction()
 {
     $type = $this->getRequest()->getParam('type');
     if ($type === false) {
         $usageInfo = $this->formatConsoleFullUsageInfo(array_merge(self::getConsoleUsage(), InitParamListener::getConsoleUsage()));
         return $usageInfo;
     }
     switch ($type) {
         case UserConfig::KEY_LANGUAGE:
             return $this->arrayToString($this->options->getLocaleList());
         case UserConfig::KEY_CURRENCY:
             return $this->arrayToString($this->options->getCurrencyList());
         case UserConfig::KEY_TIMEZONE:
             return $this->arrayToString($this->options->getTimezoneList());
         case self::HELP_LIST_OF_MODULES:
             return $this->getModuleListMsg();
         default:
             $usages = self::getCommandUsage();
             if (isset($usages[$type])) {
                 if ($usages[$type]) {
                     $formatted = $this->formatCliUsage($usages[$type]);
                     return "\nAvailable parameters:\n{$formatted}\n";
                 }
                 return "\nThis command has no parameters.\n";
             }
             throw new \InvalidArgumentException("Unknown type: {$type}");
     }
 }
    /**
     * @param array $expected
     *
     * @dataProvider indexActionDataProvider
     */
    public function testIndexAction($expected)
    {
        $this->sampleData->expects($this->once())->method('isDeployed')->willReturn($expected['isSampledataEnabled']);
        $this->sampleData->expects($this->once())->method('isInstalledSuccessfully')
            ->willReturn($expected['isSampleDataInstalled']);
        $this->sampleData->expects($this->once())->method('isInstallationError')
            ->willReturn($expected['isSampleDataErrorInstallation']);
        $this->lists->expects($this->once())->method('getTimezoneList')->willReturn($expected['timezone']);
        $this->lists->expects($this->once())->method('getCurrencyList')->willReturn($expected['currency']);
        $this->lists->expects($this->once())->method('getLocaleList')->willReturn($expected['language']);

        $viewModel = $this->controller->indexAction();

        $this->assertInstanceOf('Zend\View\Model\ViewModel', $viewModel);
        $this->assertTrue($viewModel->terminate());

        $variables = $viewModel->getVariables();
        $this->assertArrayHasKey('timezone', $variables);
        $this->assertArrayHasKey('currency', $variables);
        $this->assertArrayHasKey('language', $variables);
        $this->assertSame($expected, $variables);
    }
 /**
  * @param string $type
  * @param string $method
  * @param array $expectedValue
  *
  * @dataProvider helpActionForLanguageCurrencyTimezoneDataProvider
  */
 public function testHelpActionForLanguageCurrencyTimezone($type, $method, $expectedValue)
 {
     $this->request->expects($this->once())->method('getParam')->willReturn($type);
     $this->options->expects($this->once())->method($method)->willReturn($expectedValue);
     $returnValue = $this->controller->helpAction();
     //Need to convert from String to associative array.
     $result = explode("\n", trim($returnValue));
     $actual = [];
     foreach ($result as $value) {
         $tempArray = explode(' => ', $value);
         $actual[$tempArray[0]] = $tempArray[1];
     }
     $this->assertSame($expectedValue, $actual);
 }
 public function testGetLocaleList()
 {
     $locales = array_intersect($this->expectedLocales, array_keys($this->lists->getLocaleList()));
     $this->assertEquals($this->expectedLocales, $locales);
 }
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     foreach ($this->lists->getCurrencyList() as $key => $currency) {
         $output->writeln($key . ' => ' . $currency);
     }
 }
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     foreach ($this->lists->getTimezoneList() as $key => $timezone) {
         $output->writeln($key . ' => ' . $timezone);
     }
 }
 /**
  * @return ViewModel
  */
 public function indexAction()
 {
     $view = new ViewModel(['timezone' => $this->list->getTimezoneList(), 'currency' => $this->list->getCurrencyList(), 'language' => $this->list->getLocaleList(), 'isSampledataEnabled' => $this->sampleData->isDeployed()]);
     $view->setTerminal(true);
     return $view;
 }