Esempio n. 1
0
 /**
  * Validate currency code
  *
  * @param string $currencyCode
  * @return bool
  * @api
  */
 public function isValid($currencyCode)
 {
     $isValid = true;
     $allowedCurrencyCodes = array_keys($this->lists->getCurrencyList());
     if (!$currencyCode || !in_array($currencyCode, $allowedCurrencyCodes)) {
         $isValid = false;
     }
     return $isValid;
 }
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $table = $this->getHelperSet()->get('table');
     $table->setHeaders(['Currency', 'Code']);
     foreach ($this->lists->getCurrencyList() as $key => $currency) {
         $table->addRow([$currency, $key]);
     }
     $table->render($output);
 }
Esempio n. 3
0
 /**
  * @return ViewModel
  */
 public function indexAction()
 {
     $view = new ViewModel([
         'timezone' => $this->list->getTimezoneList(),
         'currency' => $this->list->getCurrencyList(),
         'language' => $this->list->getLocaleList(),
         'isSampledataEnabled' => $this->sampleData->isDeployed(),
         'isSampleDataInstalled' => $this->sampleData->isInstalledSuccessfully(),
         'isSampleDataErrorInstallation' => $this->sampleData->isInstallationError()
     ]);
     $view->setTerminal(true);
     return $view;
 }
 /**
  * @return ViewModel
  */
 public function indexAction()
 {
     $sampleDataDeployed = $this->moduleList->has('Magento_SampleData');
     if ($sampleDataDeployed) {
         /** @var \Magento\Framework\Setup\SampleData\State $sampleData */
         $sampleData = $this->objectManagerProvider->get()->get('Magento\\Framework\\Setup\\SampleData\\State');
         $isSampleDataInstalled = $sampleData->isInstalled();
         $isSampleDataErrorInstallation = $sampleData->hasError();
     } else {
         $isSampleDataInstalled = false;
         $isSampleDataErrorInstallation = false;
     }
     $view = new ViewModel(['timezone' => $this->list->getTimezoneList(), 'currency' => $this->list->getCurrencyList(), 'language' => $this->list->getLocaleList(), 'isSampleDataInstalled' => $isSampleDataInstalled, 'isSampleDataErrorInstallation' => $isSampleDataErrorInstallation]);
     $view->setTerminal(true);
     return $view;
 }
Esempio n. 5
0
 public function testGetCurrencyList()
 {
     $currencies = array_intersect($this->expectedCurrencies, array_keys($this->lists->getCurrencyList()));
     $this->assertEquals($this->expectedCurrencies, $currencies);
 }