public function setUp()
 {
     $this->mockSymbolFactory = $this->getMock('Magento\\CurrencySymbol\\Model\\System\\CurrencysymbolFactory', ['create'], [], '', false);
     $this->mockSymbol = $this->getMock('Magento\\CurrencySymbol\\Model\\System\\Currencysymbol', ['getCurrencySymbol'], [], '', false);
     $this->mockEventObserver = $this->getMock('Magento\\Framework\\Event\\Observer', ['getEvent'], [], '', false);
     $this->mockEvent = $this->getMock('Magento\\Framework\\Event', ['getBaseCode', 'getCurrencyOptions'], [], '', false);
     $this->mockEventObserver->expects($this->any())->method('getEvent')->willReturn($this->mockEvent);
     $this->mockSymbolFactory->expects($this->any())->method('create')->willReturn($this->mockSymbol);
     $this->observer = new \Magento\CurrencySymbol\Observer\CurrencyDisplayOptions($this->mockSymbolFactory);
 }
 /**
  * Get currency display options
  *
  * @param string $baseCode
  * @return array
  */
 protected function getCurrencyOptions($baseCode)
 {
     $currencyOptions = [];
     if ($baseCode) {
         $customCurrencySymbol = $this->symbolFactory->create()->getCurrencySymbol($baseCode);
         if ($customCurrencySymbol) {
             $currencyOptions[Currency::CURRENCY_OPTION_SYMBOL] = $customCurrencySymbol;
             $currencyOptions[Currency::CURRENCY_OPTION_DISPLAY] = \Magento\Framework\Currency::USE_SYMBOL;
         }
     }
     return $currencyOptions;
 }
Example #3
0
 /**
  * Get currency display options
  *
  * @param string $baseCode
  * @return array
  */
 public function getCurrencyOptions($baseCode)
 {
     $currencyOptions = [];
     $currencySymbol = $this->_symbolFactory->create();
     if ($currencySymbol) {
         $customCurrencySymbol = $currencySymbol->getCurrencySymbol($baseCode);
         if ($customCurrencySymbol) {
             $currencyOptions['symbol'] = $customCurrencySymbol;
             $currencyOptions['display'] = \Magento\Framework\Currency::USE_SYMBOL;
         }
     }
     return $currencyOptions;
 }
 /**
  * Returns Custom currency symbol properties
  *
  * @return array
  */
 public function getCurrencySymbolsData()
 {
     if (!$this->_symbolsData) {
         $this->_symbolsData = $this->_symbolSystemFactory->create()->getCurrencySymbolsData();
     }
     return $this->_symbolsData;
 }