Skip to content

Commit 502b59c

Browse files
committed
Merge remote-tracking branch 'mainline/develop' into develop
2 parents 17d9c1d + 5e16608 commit 502b59c

File tree

91 files changed

+2580
-444
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

91 files changed

+2580
-444
lines changed

app/code/Magento/Backend/i18n/en_US.csv

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -456,3 +456,4 @@ Pagination,Pagination
456456
"Anchor Text for Next","Anchor Text for Next"
457457
"Alternative text for the next pages link in the pagination menu. If empty, default arrow image is used.","Alternative text for the next pages link in the pagination menu. If empty, default arrow image is used."
458458
"Theme Name","Theme Name"
459+
"Deployment config file %1 is not writable.","Deployment config file %1 is not writable."

app/code/Magento/Backup/Model/Fs/Collection.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,10 @@ protected function _generateRow($filename)
110110
$row[$key] = $value;
111111
}
112112
$row['size'] = $this->_varDirectory->stat($this->_varDirectory->getRelativePath($filename))['size'];
113-
$row['id'] = $row['time'] . '_' . $row['type'];
113+
if (isset($row['display_name']) && $row['display_name'] == '') {
114+
$row['display_name'] = 'WebSetupWizard';
115+
}
116+
$row['id'] = $row['time'] . '_' . $row['type'] . (isset($row['display_name']) ? $row['display_name'] : '');
114117
return $row;
115118
}
116119
}

app/code/Magento/Braintree/etc/adminhtml/di.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
</arguments>
2020
</type>
2121

22-
<virtualType name="BraintreeAuthorizeDataBuilder" type="Magento\Payment\Gateway\Request\BuilderComposite">
22+
<virtualType name="BraintreeAuthorizeRequest" type="Magento\Payment\Gateway\Request\BuilderComposite">
2323
<arguments>
2424
<argument name="builders" xsi:type="array">
2525
<item name="customer" xsi:type="string">Magento\Braintree\Gateway\Request\CustomerDataBuilder</item>
@@ -30,7 +30,7 @@
3030
</argument>
3131
</arguments>
3232
</virtualType>
33-
<virtualType name="BraintreeVaultAuthorizeDataBuilder" type="Magento\Payment\Gateway\Request\BuilderComposite">
33+
<virtualType name="BraintreeVaultAuthorizeRequest" type="Magento\Payment\Gateway\Request\BuilderComposite">
3434
<arguments>
3535
<argument name="builders" xsi:type="array">
3636
<item name="customer" xsi:type="string">Magento\Braintree\Gateway\Request\CustomerDataBuilder</item>

app/code/Magento/Catalog/Helper/Product/ProductList.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class ProductList
1818
*/
1919
const XML_PATH_LIST_MODE = 'catalog/frontend/list_mode';
2020

21-
const VIEW_MODE_LIST = 'view';
21+
const VIEW_MODE_LIST = 'list';
2222
const VIEW_MODE_GRID = 'grid';
2323

2424
const DEFAULT_SORT_DIRECTION = 'asc';

app/code/Magento/Catalog/Test/Unit/Ui/DataProvider/Product/Form/Modifier/EavTest.php

100644100755
Lines changed: 63 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
use Magento\Eav\Model\Config;
1111
use Magento\Framework\App\RequestInterface;
1212
use Magento\Store\Model\StoreManagerInterface;
13+
use Magento\Store\Api\Data\StoreInterface;
1314
use Magento\Ui\DataProvider\EavValidationRules;
1415
use Magento\Eav\Model\ResourceModel\Entity\Attribute\Group\Collection as GroupCollection;
1516
use Magento\Eav\Model\ResourceModel\Entity\Attribute\Group\CollectionFactory as GroupCollectionFactory;
@@ -28,6 +29,9 @@
2829
use Magento\Catalog\Api\Data\ProductAttributeInterface;
2930
use Magento\Eav\Api\Data\AttributeGroupInterface;
3031
use Magento\Catalog\Model\ResourceModel\Eav\Attribute;
32+
use Magento\Framework\Currency;
33+
use Magento\Framework\Locale\Currency as CurrencyLocale;
34+
Use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
3135

3236
/**
3337
* Class EavTest
@@ -138,9 +142,35 @@ class EavTest extends AbstractModifierTest
138142
*/
139143
private $eavAttributeMock;
140144

145+
/**
146+
* @var StoreInterface|\PHPUnit_Framework_MockObject_MockObject
147+
*/
148+
protected $storeMock;
149+
150+
/**
151+
* @var Currency|\PHPUnit_Framework_MockObject_MockObject
152+
*/
153+
protected $currencyMock;
154+
155+
/**
156+
* @var CurrencyLocale|\PHPUnit_Framework_MockObject_MockObject
157+
*/
158+
protected $currencyLocaleMock;
159+
160+
/**
161+
* @var ObjectManager
162+
*/
163+
protected $objectManager;
164+
165+
/**
166+
* @var Eav
167+
*/
168+
protected $eav;
169+
141170
protected function setUp()
142171
{
143172
parent::setUp();
173+
$this->objectManager = new ObjectManager($this);
144174
$this->eavConfigMock = $this->getMockBuilder(Config::class)
145175
->disableOriginalConstructor()
146176
->getMock();
@@ -236,6 +266,24 @@ protected function setUp()
236266
->willReturn([
237267
$this->attributeMock,
238268
]);
269+
$this->storeMock = $this->getMockBuilder(StoreInterface::class)
270+
->setMethods(['load', 'getId', 'getConfig', 'getBaseCurrencyCode'])
271+
->getMockForAbstractClass();
272+
$this->currencyMock = $this->getMockBuilder(Currency::class)
273+
->disableOriginalConstructor()
274+
->setMethods(['toCurrency'])
275+
->getMock();
276+
$this->currencyLocaleMock = $this->getMockBuilder(CurrencyLocale::class)
277+
->disableOriginalConstructor()
278+
->setMethods(['getCurrency'])
279+
->getMock();
280+
281+
$this->eav =$this->getModel();
282+
$this->objectManager->setBackwardCompatibleProperty(
283+
$this->eav,
284+
'localeCurrency',
285+
$this->currencyLocaleMock
286+
);
239287
}
240288

241289
/**
@@ -255,7 +303,7 @@ protected function createModel()
255303
'searchCriteriaBuilder' => $this->searchCriteriaBuilderMock,
256304
'attributeGroupRepository' => $this->attributeGroupRepositoryMock,
257305
'sortOrderBuilder' => $this->sortOrderBuilderMock,
258-
'attributeRepository' => $this->attributeRepositoryMock
306+
'attributeRepository' => $this->attributeRepositoryMock,
259307
]);
260308
}
261309

@@ -336,6 +384,19 @@ public function testModifyData()
336384
->method('getItems')
337385
->willReturn([$this->eavAttributeMock]);
338386

339-
$this->assertEquals($sourceData, $this->getModel()->modifyData([]));
387+
$this->storeMock->expects(($this->once()))
388+
->method('getBaseCurrencyCode')
389+
->willReturn('en_US');
390+
$this->storeManagerMock->expects($this->once())
391+
->method('getStore')
392+
->willReturn($this->storeMock);
393+
$this->currencyMock->expects($this->once())
394+
->method('toCurrency')
395+
->willReturn('19.99');
396+
$this->currencyLocaleMock->expects($this->once())
397+
->method('getCurrency')
398+
->willReturn($this->currencyMock);
399+
400+
$this->assertEquals($sourceData, $this->eav->modifyData([]));
340401
}
341402
}

app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/CustomOptions.php

100644100755
Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
use Magento\Ui\Component\Form\Element\ActionDelete;
2323
use Magento\Ui\Component\Form\Element\DataType\Text;
2424
use Magento\Ui\Component\Form\Element\DataType\Number;
25+
use Magento\Framework\Locale\CurrencyInterface;
2526

2627
/**
2728
* Data provider for "Customizable Options" panel
@@ -111,7 +112,7 @@ class CustomOptions extends AbstractModifier
111112
* @var UrlInterface
112113
*/
113114
protected $urlBuilder;
114-
115+
115116
/**
116117
* @var ArrayManager
117118
*/
@@ -122,6 +123,11 @@ class CustomOptions extends AbstractModifier
122123
*/
123124
protected $meta = [];
124125

126+
/**
127+
* @var CurrencyInterface
128+
*/
129+
private $localeCurrency;
130+
125131
/**
126132
* @param LocatorInterface $locator
127133
* @param StoreManagerInterface $storeManager
@@ -1069,4 +1075,38 @@ protected function getCurrencySymbol()
10691075
{
10701076
return $this->storeManager->getStore()->getBaseCurrency()->getCurrencySymbol();
10711077
}
1078+
1079+
/**
1080+
* The getter function to get the locale currency for real application code
1081+
*
1082+
* @return \Magento\Framework\Locale\CurrencyInterface
1083+
*
1084+
* @deprecated
1085+
*/
1086+
private function getLocaleCurrency()
1087+
{
1088+
if ($this->localeCurrency === null) {
1089+
$this->localeCurrency = \Magento\Framework\App\ObjectManager::getInstance()->get(CurrencyInterface::class);
1090+
}
1091+
return $this->localeCurrency;
1092+
}
1093+
1094+
/**
1095+
* Format price according to the locale of the currency
1096+
*
1097+
* @param mixed $value
1098+
* @return string
1099+
*/
1100+
protected function formatPrice($value)
1101+
{
1102+
if (!is_numeric($value)) {
1103+
return null;
1104+
}
1105+
1106+
$store = $this->storeManager->getStore();
1107+
$currency = $this->getLocaleCurrency()->getCurrency($store->getBaseCurrencyCode());
1108+
$value = $currency->toCurrency($value, ['display' => \Magento\Framework\Currency::NO_SYMBOL]);
1109+
1110+
return $value;
1111+
}
10721112
}

app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/Eav.php

100644100755
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
use Magento\Ui\DataProvider\Mapper\MetaProperties as MetaPropertiesMapper;
3131
use Magento\Ui\Component\Form\Element\Wysiwyg as WysiwygElement;
3232
use Magento\Catalog\Model\Attribute\ScopeOverriddenValue;
33+
use Magento\Framework\Locale\CurrencyInterface;
3334

3435
/**
3536
* Class Eav
@@ -161,6 +162,11 @@ class Eav extends AbstractModifier
161162
*/
162163
private $prevSetAttributes;
163164

165+
/**
166+
* @var CurrencyInterface
167+
*/
168+
private $localeCurrency;
169+
164170
/**
165171
* @param LocatorInterface $locator
166172
* @param CatalogEavValidationRules $catalogEavValidationRules
@@ -867,4 +873,38 @@ private function calculateGroupCode(AttributeGroupInterface $group)
867873

868874
return $attributeGroupCode;
869875
}
876+
877+
/**
878+
* The getter function to get the locale currency for real application code
879+
*
880+
* @return \Magento\Framework\Locale\CurrencyInterface
881+
*
882+
* @deprecated
883+
*/
884+
private function getLocaleCurrency()
885+
{
886+
if ($this->localeCurrency === null) {
887+
$this->localeCurrency = \Magento\Framework\App\ObjectManager::getInstance()->get(CurrencyInterface::class);
888+
}
889+
return $this->localeCurrency;
890+
}
891+
892+
/**
893+
* Format price according to the locale of the currency
894+
*
895+
* @param mixed $value
896+
* @return string
897+
*/
898+
protected function formatPrice($value)
899+
{
900+
if (!is_numeric($value)) {
901+
return null;
902+
}
903+
904+
$store = $this->storeManager->getStore();
905+
$currency = $this->getLocaleCurrency()->getCurrency($store->getBaseCurrencyCode());
906+
$value = $currency->toCurrency($value, ['display' => \Magento\Framework\Currency::NO_SYMBOL]);
907+
908+
return $value;
909+
}
870910
}

0 commit comments

Comments
 (0)