Skip to content
This repository was archived by the owner on Apr 29, 2019. It is now read-only.

Commit 4340ef7

Browse files
committed
MAGETWO-87524: [EngCom Team] Batch 32. Forwardports to 2.3-develop #1359
- Merge Pull Request magento-engcom/magento2ce#1359 from magento-engcom-team/magento2:batch-32-forwardport-2.3-develop - Merged commits: 1. 1db3f8f 2. 412d228 3. 02620b0 4. 57c5d8a 5. 94a3f03 6. 0d557dc 7. 48baf59 8. dc3bb78 9. 0ab4533 10. 00f64b0 11. 440a1b5 12. 4ed8f5b 13. 656eeb5 14. fd2f731 15. 2c1a23f 16. f7ff71a 17. ac9bcfa 18. 55debe0 19. 3495086 20. d678f15 21. bf8ee30 22. 335c91c 23. c5a823f 24. 696a5a5
2 parents 1dcb55d + 696a5a5 commit 4340ef7

File tree

22 files changed

+563
-26
lines changed

22 files changed

+563
-26
lines changed

app/bootstrap.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,13 @@
4949
unset($_SERVER['ORIG_PATH_INFO']);
5050
}
5151

52-
if (!empty($_SERVER['MAGE_PROFILER'])
52+
if (
53+
(!empty($_SERVER['MAGE_PROFILER']) || file_exists(BP . '/var/profiler.flag'))
5354
&& isset($_SERVER['HTTP_ACCEPT'])
5455
&& strpos($_SERVER['HTTP_ACCEPT'], 'text/html') !== false
5556
) {
5657
\Magento\Framework\Profiler::applyConfig(
57-
$_SERVER['MAGE_PROFILER'],
58+
(isset($_SERVER['MAGE_PROFILER']) && strlen($_SERVER['MAGE_PROFILER'])) ? $_SERVER['MAGE_PROFILER'] : trim(file_get_contents(BP . '/var/profiler.flag')),
5859
BP,
5960
!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest'
6061
);

app/code/Magento/Bundle/Controller/Adminhtml/Product/Initialization/Helper/Plugin/Bundle.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ protected function processBundleOptionsData(\Magento\Catalog\Model\Product $prod
127127
}
128128
$options = [];
129129
foreach ($bundleOptionsData as $key => $optionData) {
130-
if ((bool)$optionData['delete']) {
130+
if (!empty($optionData['delete'])) {
131131
continue;
132132
}
133133

app/code/Magento/Bundle/Test/Unit/Controller/Adminhtml/Product/Initialization/Helper/Plugin/BundleTest.php

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,10 @@ protected function setUp()
5757
'setOptions',
5858
'setCanSaveBundleSelections',
5959
'__wakeup',
60-
'getOptionsReadonly'
60+
'getOptionsReadonly',
61+
'getBundleOptionsData',
62+
'getExtensionAttributes',
63+
'setExtensionAttributes',
6164
];
6265
$this->productMock = $this->createPartialMock(\Magento\Catalog\Model\Product::class, $methods);
6366
$optionInterfaceFactory = $this->getMockBuilder(\Magento\Bundle\Api\Data\OptionInterfaceFactory::class)
@@ -127,6 +130,17 @@ public function testAfterInitializeIfBundleAnsCustomOptionsAndBundleSelectionsEx
127130
);
128131
$this->productMock->expects($this->once())->method('setOptions')->with(null);
129132
$this->productMock->expects($this->once())->method('setCanSaveBundleSelections')->with(true);
133+
$this->productMock->expects($this->once())
134+
->method('getBundleOptionsData')
135+
->willReturn(['option_1' => ['delete' => 1]]);
136+
$extentionAttribute = $this->getMockBuilder(\Magento\Catalog\Api\Data\ProductExtensionInterface::class)
137+
->disableOriginalConstructor()
138+
->setMethods(['setBundleProductOptions'])
139+
->getMockForAbstractClass();
140+
$extentionAttribute->expects($this->once())->method('setBundleProductOptions')->with([]);
141+
$this->productMock->expects($this->once())->method('getExtensionAttributes')->willReturn($extentionAttribute);
142+
$this->productMock->expects($this->once())->method('setExtensionAttributes')->with($extentionAttribute);
143+
130144
$this->model->afterInitialize($this->subjectMock, $this->productMock);
131145
}
132146

app/code/Magento/Catalog/Model/Product/Option/Value.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
use Magento\Catalog\Model\Product;
1010
use Magento\Catalog\Model\Product\Option;
11+
use Magento\Catalog\Pricing\Price\BasePrice;
1112
use Magento\Framework\Model\AbstractModel;
1213

1314
/**
@@ -221,7 +222,7 @@ public function saveValues()
221222
public function getPrice($flag = false)
222223
{
223224
if ($flag && $this->getPriceType() == self::TYPE_PERCENT) {
224-
$basePrice = $this->getOption()->getProduct()->getFinalPrice();
225+
$basePrice = $this->getOption()->getProduct()->getPriceInfo()->getPrice(BasePrice::PRICE_CODE)->getValue();
225226
$price = $basePrice * ($this->_getData(self::KEY_PRICE) / 100);
226227
return $price;
227228
}

app/code/Magento/Catalog/Test/Unit/Model/Product/Option/ValueTest.php

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,8 @@ private function getMockedValueCollectionFactory()
104104

105105
$mockBuilder =
106106
$this->getMockBuilder(\Magento\Catalog\Model\ResourceModel\Product\Option\Value\CollectionFactory::class)
107-
->setMethods(['create'])
108-
->disableOriginalConstructor();
107+
->setMethods(['create'])
108+
->disableOriginalConstructor();
109109
$mock = $mockBuilder->getMock();
110110

111111
$mock->expects($this->any())
@@ -164,13 +164,27 @@ private function getMockedOption()
164164
private function getMockedProduct()
165165
{
166166
$mockBuilder = $this->getMockBuilder(\Magento\Catalog\Model\Product::class)
167-
->setMethods(['getFinalPrice', '__wakeup'])
167+
->setMethods(['getPriceInfo', '__wakeup'])
168168
->disableOriginalConstructor();
169169
$mock = $mockBuilder->getMock();
170170

171-
$mock->expects($this->any())
172-
->method('getFinalPrice')
173-
->will($this->returnValue(10));
171+
$priceInfoMock = $this->getMockForAbstractClass(
172+
\Magento\Framework\Pricing\PriceInfoInterface::class,
173+
[],
174+
'',
175+
false,
176+
false,
177+
true,
178+
['getPrice']
179+
);
180+
181+
$priceMock = $this->getMockForAbstractClass(\Magento\Framework\Pricing\Price\PriceInterface::class);
182+
183+
$priceInfoMock->expects($this->any())->method('getPrice')->willReturn($priceMock);
184+
185+
$mock->expects($this->any())->method('getPriceInfo')->willReturn($priceInfoMock);
186+
187+
$priceMock->expects($this->any())->method('getValue')->willReturn(10);
174188

175189
return $mock;
176190
}

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

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,16 @@ public function testModifyMeta()
154154
->method('getAll')
155155
->willReturn([]);
156156

157-
$this->assertArrayHasKey(CustomOptions::GROUP_CUSTOM_OPTIONS_NAME, $this->getModel()->modifyMeta([]));
157+
$meta = $this->getModel()->modifyMeta([]);
158+
159+
$this->assertArrayHasKey(CustomOptions::GROUP_CUSTOM_OPTIONS_NAME, $meta);
160+
161+
$buttonAdd = $meta['custom_options']['children']['container_header']['children']['button_add'];
162+
$buttonAddTargetName = $buttonAdd['arguments']['data']['config']['actions'][0]['targetName'];
163+
$expectedTargetName = '${ $.ns }.${ $.ns }.' . CustomOptions::GROUP_CUSTOM_OPTIONS_NAME
164+
. '.' . CustomOptions::GRID_OPTIONS_NAME;
165+
166+
$this->assertEquals($expectedTargetName, $buttonAddTargetName);
158167
}
159168

160169
/**

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,8 @@ protected function getHeaderContainerConfig($sortOrder)
348348
'sortOrder' => 20,
349349
'actions' => [
350350
[
351-
'targetName' => 'ns = ${ $.ns }, index = ' . static::GRID_OPTIONS_NAME,
351+
'targetName' => '${ $.ns }.${ $.ns }.' . static::GROUP_CUSTOM_OPTIONS_NAME
352+
. '.' . static::GRID_OPTIONS_NAME,
352353
'actionName' => 'processingAddChild',
353354
]
354355
]

app/code/Magento/Checkout/Model/Cart.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,11 @@
1313

1414
/**
1515
* Shopping cart model
16+
*
1617
* @api
1718
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
18-
* @deprecated 100.1.0
19+
* @deprecated 100.1.0 Use \Magento\Quote\Model\Quote instead
20+
* @see \Magento\Quote\Api\Data\CartInterface
1921
*/
2022
class Cart extends DataObject implements CartInterface
2123
{

app/code/Magento/Checkout/Model/Cart/CartInterface.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
*
1313
* @api
1414
* @author Magento Core Team <[email protected]>
15-
* @deprecated 100.1.0
15+
* @deprecated 100.1.0 Use \Magento\Quote\Api\Data\CartInterface instead
16+
* @see \Magento\Quote\Api\Data\CartInterface
1617
*/
1718
interface CartInterface
1819
{

app/code/Magento/Config/Model/Config/Structure/Reader.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,14 +124,18 @@ protected function _readFiles($fileList)
124124
* Processing nodes of the document before merging
125125
*
126126
* @param string $content
127+
* @throws \Magento\Framework\Config\Dom\ValidationException
127128
* @return string
128129
*/
129130
protected function processingDocument($content)
130131
{
131132
$object = new DataObject();
132133
$document = new \DOMDocument();
133-
134-
$document->loadXML($content);
134+
try {
135+
$document->loadXML($content);
136+
} catch (\Exception $e) {
137+
throw new \Magento\Framework\Config\Dom\ValidationException($e->getMessage());
138+
}
135139
$this->compiler->compile($document->documentElement, $object, $object);
136140

137141
return $document->saveXML();

0 commit comments

Comments
 (0)