/** * @magentoDbIsolation enabled */ public function testSetCurrencySymbolsData() { $currencySymbolsData = $this->currencySymbolModel->getCurrencySymbolsData(); $this->assertArrayHasKey('EUR', $currencySymbolsData); //Change currency symbol $currencySymbolsData = ['EUR' => '@']; $this->currencySymbolModel->setCurrencySymbolsData($currencySymbolsData); //Verify if the new symbol is set $this->assertEquals('@', $this->currencySymbolModel->getCurrencySymbolsData()['EUR']['displaySymbol'], 'Symbol not set correctly.'); $this->assertEquals('@', $this->currencySymbolModel->getCurrencySymbol('EUR'), 'Symbol not set correctly.'); }
public function testSetCurrencySymbolData() { $websiteId = 1; $groupId = 2; $currencies = 'USD,EUR'; $symbols = []; $value['options']['fields']['customsymbol']['inherit'] = 1; $this->prepareMocksForGetCurrencySymbolsData($websiteId, $groupId, $currencies); /** * @var \Magento\Config\Model\Config|\PHPUnit_Framework_MockObject_MockObject */ $configMock = $this->getMock('Magento\\Config\\Model\\Config', ['setSection', 'setWebsite', 'setStore', 'setGroups', 'save'], [], '', false); $this->configFactoryMock->expects($this->any())->method('create')->willReturn($configMock); $configMock->expects($this->any())->method('setSection')->with(Currencysymbol::CONFIG_SECTION)->willReturnSelf(); $configMock->expects($this->any())->method('setWebsite')->with(null)->willReturnSelf(); $configMock->expects($this->any())->method('setStore')->with(null)->willReturnSelf(); $configMock->expects($this->any())->method('setGroups')->with($value)->willReturnSelf(); $this->coreConfigMock->expects($this->once())->method('reinit'); $this->cacheTypeListMock->expects($this->atLeastOnce())->method('invalidate'); $this->eventManagerMock->expects($this->atLeastOnce())->method('dispatch')->willReturnMap([['admin_system_config_changed_section_currency_before_reinit', null, null], ['admin_system_config_changed_section_currency', null, null]]); $this->assertInstanceOf('Magento\\CurrencySymbol\\Model\\System\\Currencysymbol', $this->model->setCurrencySymbolsData($symbols)); }