32 $backendData = $this->createMock(\
Magento\Backend\Helper\Data::class);
33 $this->_requestMock = $this->getMockForAbstractClass(
34 \
Magento\Framework\
App\RequestInterface::class,
42 $this->_configMock = $this->createMock(\
Magento\Framework\
App\Config\ScopeConfigInterface::class);
43 $this->_storeManagerMock = $this->createMock(\
Magento\Store\Model\StoreManager::class);
44 $this->_model = new \Magento\Directory\Model\Currency\DefaultLocator(
46 $this->_storeManagerMock
52 $this->_configMock->expects($this->once())->method(
'getValue')->will($this->returnValue(
'storeCurrency'));
53 $this->assertEquals(
'storeCurrency', $this->_model->getDefaultCurrency($this->_requestMock));
58 $this->_requestMock->expects(
65 $this->returnValue(
'someStore')
67 $storeMock = $this->createMock(\
Magento\Store\Model\Store::class);
68 $storeMock->expects($this->once())->method(
'getBaseCurrencyCode')->will($this->returnValue(
'storeCurrency'));
69 $this->_storeManagerMock->expects(
76 $this->returnValue($storeMock)
78 $this->assertEquals(
'storeCurrency', $this->_model->getDefaultCurrency($this->_requestMock));
83 $this->_requestMock->expects(
88 $this->returnValueMap([[
'store',
null,
''], [
'website',
null,
'someWebsite']])
90 $websiteMock = $this->createMock(\
Magento\Store\Model\Website::class);
91 $websiteMock->expects(
96 $this->returnValue(
'websiteCurrency')
98 $this->_storeManagerMock->expects(
105 $this->returnValue($websiteMock)
107 $this->assertEquals(
'websiteCurrency', $this->_model->getDefaultCurrency($this->_requestMock));
112 $this->_requestMock->expects(
117 $this->returnValueMap(
118 [[
'store',
null,
''], [
'website',
null,
''], [
'group',
null,
'someGroup']]
121 $websiteMock = $this->createMock(\
Magento\Store\Model\Website::class);
122 $websiteMock->expects(
125 'getBaseCurrencyCode' 127 $this->returnValue(
'websiteCurrency')
130 $groupMock = $this->createMock(\
Magento\Store\Model\Group::class);
131 $groupMock->expects($this->once())->method(
'getWebsite')->will($this->returnValue($websiteMock));
133 $this->_storeManagerMock->expects(
140 $this->returnValue($groupMock)
142 $this->assertEquals(
'websiteCurrency', $this->_model->getDefaultCurrency($this->_requestMock));
testGetDefaultCurrencyReturnWebsiteDefaultCurrency()
testGetDefaultCurrencyReturnStoreDefaultCurrency()
testGetDefaultCurrencyReturnGroupDefaultCurrency()
testGetDefaultCurrencyReturnDefaultStoreDefaultCurrencyIfNoStoreIsSpecified()