Skip to content

Commit 1c2de6a

Browse files
committed
Merge remote-tracking branch 'upstream/develop' into feature/fix-to-array
2 parents 2fec2ab + d31d651 commit 1c2de6a

File tree

275 files changed

+7288
-3056
lines changed

Some content is hidden

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

275 files changed

+7288
-3056
lines changed

.htaccess

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -285,10 +285,3 @@
285285
## http://developer.yahoo.com/performance/rules.html#etags
286286

287287
#FileETag none
288-
289-
############################################
290-
## Add custom headers
291-
<IfModule mod_headers.c>
292-
Header set X-Content-Type-Options "nosniff"
293-
Header set X-XSS-Protection "1; mode=block"
294-
</IfModule>

app/code/Magento/Authorizenet/Test/Unit/Model/DirectpostTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ public function testCheckResponseCodeFailure($responseCode)
331331
$this->dataHelperMock->expects($this->any())
332332
->method('wrapGatewayError')
333333
->with($reasonText)
334-
->willReturn(__('Gateway error: ' . $reasonText));
334+
->willReturn(__('Gateway error: %1', $reasonText));
335335

336336
$this->directpost->checkResponseCode();
337337
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@
127127
</argument>
128128
</arguments>
129129
</type>
130-
<type name="Magento\Framework\App\Response\Header\XFrameOptions">
130+
<type name="Magento\Framework\App\Response\HeaderProvider\XFrameOptions">
131131
<arguments>
132132
<argument name="xFrameOpt" xsi:type="const">Magento\Framework\App\Response\HeaderProvider\XFrameOptions::BACKEND_X_FRAME_OPT</argument>
133133
</arguments>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ YTD,YTD
306306
"Maximum sender name length is 255. Please correct your settings.","Maximum sender name length is 255. Please correct your settings."
307307
"The file you're uploading exceeds the server size limit of %1 kilobytes.","The file you're uploading exceeds the server size limit of %1 kilobytes."
308308
"The base directory to upload file is not specified.","The base directory to upload file is not specified."
309-
"The specified image adapter cannot be used because of: ","The specified image adapter cannot be used because of: "
309+
"The specified image adapter cannot be used because of: %1","The specified image adapter cannot be used because of: %1"
310310
"Default scope","Default scope"
311311
"Base currency","Base currency"
312312
"Display default currency","Display default currency"

app/code/Magento/Braintree/Test/Unit/Model/System/Config/Backend/CountrycreditcardTest.php

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,30 +26,25 @@ class CountrycreditcardTest extends \PHPUnit_Framework_TestCase
2626
*/
2727
protected $objectManagerHelper;
2828

29-
/**
30-
* @var \Magento\Framework\App\Config\ScopeConfigInterface|\PHPUnit_Framework_MockObject_MockObject
31-
*/
32-
protected $resourceMock;
33-
3429
/**
3530
* @var \Magento\Framework\Math\Random|\PHPUnit_Framework_MockObject_MockObject
3631
*/
3732
protected $mathRandomMock;
3833

3934
protected function setUp()
4035
{
41-
$this->resourceMock = $this->getMockForAbstractClass('\Magento\Framework\Model\ResourceModel\AbstractResource');
36+
$this->objectManagerHelper = new ObjectManagerHelper($this);
37+
4238
$this->mathRandomMock = $this->getMockBuilder(
4339
'\Magento\Framework\Math\Random'
4440
)->disableOriginalConstructor()
4541
->getMock();
4642

47-
$this->objectManagerHelper = new ObjectManagerHelper($this);
43+
4844
$this->model = $this->objectManagerHelper->getObject(
4945
'\Magento\Braintree\Model\System\Config\Backend\Countrycreditcard',
5046
[
51-
'mathRandom' => $this->mathRandomMock,
52-
'resource' => $this->resourceMock,
47+
'mathRandom' => $this->mathRandomMock
5348
]
5449
);
5550
}

app/code/Magento/Bundle/Model/Product/Type.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -636,6 +636,12 @@ protected function _prepareProduct(\Magento\Framework\DataObject $buyRequest, $p
636636
if (!empty($selectionIds)) {
637637
$selections = $this->getSelectionsByIds($selectionIds, $product);
638638

639+
if (count($selections->getItems()) !== count($selectionIds)) {
640+
throw new \Magento\Framework\Exception\LocalizedException(
641+
__('The options you selected are not available.')
642+
);
643+
}
644+
639645
// Check if added selections are still on sale
640646
$this->checkSelectionsIsSale(
641647
$selections,
@@ -808,12 +814,6 @@ public function getSelectionsByIds($selectionIds, $product)
808814
->addFilterByRequiredOptions()
809815
->setSelectionIdsFilter($selectionIds);
810816

811-
if (count($usedSelections->getItems()) !== count($selectionIds)) {
812-
throw new \Magento\Framework\Exception\LocalizedException(
813-
__('The options you selected are not available.')
814-
);
815-
}
816-
817817
if (!$this->_catalogData->isPriceGlobal() && $storeId) {
818818
$websiteId = $this->_storeManager->getStore($storeId)
819819
->getWebsiteId();

app/code/Magento/Bundle/Test/Unit/Model/Product/TypeTest.php

Lines changed: 22 additions & 128 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ function ($key) use ($optionCollection, $selectionCollection) {
232232
->willReturn('options');
233233
$option->expects($this->at(3))
234234
->method('getId')
235-
->willReturn(10);
235+
->willReturn(3);
236236
$option->expects($this->once())
237237
->method('getRequired')
238238
->willReturn(true);
@@ -379,7 +379,7 @@ function ($key) use ($optionCollection, $selectionCollection) {
379379
$resultValue = $selectionCollection;
380380
break;
381381
case '_cache_instance_used_selections_ids':
382-
$resultValue = [2, 5, 14];
382+
$resultValue = [5];
383383
break;
384384
}
385385

@@ -404,7 +404,7 @@ function ($key) use ($optionCollection, $selectionCollection) {
404404
->method('setStoreFilter');
405405
$buyRequest->expects($this->once())
406406
->method('getBundleOption')
407-
->willReturn([3 => 5, 10 => [7 => 2, 11 => 14]]);
407+
->willReturn([3 => 5]);
408408
$selectionCollection->expects($this->any())
409409
->method('getItems')
410410
->willReturn([$selection]);
@@ -433,13 +433,13 @@ function ($key) use ($optionCollection, $selectionCollection) {
433433
->willReturn($productType);
434434
$option->expects($this->at(3))
435435
->method('getId')
436-
->willReturn(10);
436+
->willReturn(3);
437437
$option->expects($this->at(9))
438438
->method('getId')
439-
->willReturn(10);
439+
->willReturn(3);
440440
$option->expects($this->once())
441441
->method('getRequired')
442-
->willReturn(true);
442+
->willReturn(false);
443443
$option->expects($this->once())
444444
->method('isMultiSelection')
445445
->willReturn(true);
@@ -611,7 +611,7 @@ function ($key) use ($optionCollection, $selectionCollection) {
611611
$resultValue = $selectionCollection;
612612
break;
613613
case '_cache_instance_used_selections_ids':
614-
$resultValue = [2, 5, 14];
614+
$resultValue = [5];
615615
break;
616616
}
617617

@@ -636,7 +636,7 @@ function ($key) use ($optionCollection, $selectionCollection) {
636636
->method('setStoreFilter');
637637
$buyRequest->expects($this->once())
638638
->method('getBundleOption')
639-
->willReturn([3 => 5, 10 => [7 => 2, 11 => 14]]);
639+
->willReturn([3 => 5]);
640640
$selectionCollection->expects($this->any())
641641
->method('getItems')
642642
->willReturn([$selection]);
@@ -665,13 +665,13 @@ function ($key) use ($optionCollection, $selectionCollection) {
665665
->willReturn($productType);
666666
$option->expects($this->at(3))
667667
->method('getId')
668-
->willReturn(10);
668+
->willReturn(3);
669669
$option->expects($this->at(9))
670670
->method('getId')
671-
->willReturn(10);
671+
->willReturn(3);
672672
$option->expects($this->once())
673673
->method('getRequired')
674-
->willReturn(true);
674+
->willReturn(false);
675675
$option->expects($this->once())
676676
->method('isMultiSelection')
677677
->willReturn(true);
@@ -831,7 +831,7 @@ function ($key) use ($optionCollection, $selectionCollection) {
831831
$resultValue = $selectionCollection;
832832
break;
833833
case '_cache_instance_used_selections_ids':
834-
$resultValue = [2, 5, 14];
834+
$resultValue = [5];
835835
break;
836836
}
837837

@@ -856,7 +856,7 @@ function ($key) use ($optionCollection, $selectionCollection) {
856856
->method('setStoreFilter');
857857
$buyRequest->expects($this->once())
858858
->method('getBundleOption')
859-
->willReturn([3 => 5, 10 => [7 => 2, 11 => 14]]);
859+
->willReturn([3 => 5]);
860860
$selectionCollection->expects($this->any())
861861
->method('getItems')
862862
->willReturn([$selection]);
@@ -885,13 +885,13 @@ function ($key) use ($optionCollection, $selectionCollection) {
885885
->willReturn($productType);
886886
$option->expects($this->at(3))
887887
->method('getId')
888-
->willReturn(10);
888+
->willReturn(3);
889889
$option->expects($this->at(9))
890890
->method('getId')
891-
->willReturn(10);
891+
->willReturn(3);
892892
$option->expects($this->once())
893893
->method('getRequired')
894-
->willReturn(true);
894+
->willReturn(false);
895895
$option->expects($this->once())
896896
->method('isMultiSelection')
897897
->willReturn(true);
@@ -1118,41 +1118,29 @@ function ($key) use ($optionCollection, $selectionCollection) {
11181118
$resultValue = $selectionCollection;
11191119
break;
11201120
case '_cache_instance_used_selections_ids':
1121-
$resultValue = [2, 5, 14];
1121+
$resultValue = [5];
11221122
break;
11231123
}
11241124

11251125
return $resultValue;
11261126
}
11271127
);
1128-
$optionCollection->expects($this->once())
1129-
->method('getItemById')
1130-
->willReturn($option);
11311128
$optionCollection->expects($this->once())
11321129
->method('appendSelections');
11331130
$productType->expects($this->once())
11341131
->method('setStoreFilter');
11351132
$buyRequest->expects($this->once())
11361133
->method('getBundleOption')
1137-
->willReturn([3 => 5, 10 => [7 => 2, 11 => 14]]);
1134+
->willReturn([3 => 5]);
11381135
$selectionCollection->expects($this->at(0))
11391136
->method('getItems')
11401137
->willReturn([$selection]);
11411138
$selectionCollection->expects($this->at(1))
11421139
->method('getItems')
11431140
->willReturn([]);
1144-
$selection->expects($this->once())
1145-
->method('isSalable')
1146-
->willReturn(false);
1147-
$option->expects($this->at(3))
1141+
$option->expects($this->any())
11481142
->method('getId')
1149-
->willReturn(10);
1150-
$option->expects($this->once())
1151-
->method('getRequired')
1152-
->willReturn(true);
1153-
$option->expects($this->once())
1154-
->method('isMultiSelection')
1155-
->willReturn(true);
1143+
->willReturn(3);
11561144

11571145
$result = $this->model->prepareForCartAdvanced($buyRequest, $product);
11581146
$this->assertEquals('Please specify product option(s).', $result);
@@ -1262,7 +1250,7 @@ function ($key) use ($optionCollection, $selectionCollection) {
12621250
$buyRequest->expects($this->once())
12631251
->method('getBundleOption')
12641252
->willReturn([3 => 5]);
1265-
$selectionCollection->expects($this->once())
1253+
$selectionCollection->expects($this->any())
12661254
->method('getItems')
12671255
->willReturn([$selection]);
12681256
$selection->expects($this->once())
@@ -1921,8 +1909,7 @@ public function testGetSelectionsByIds()
19211909
'setPositionOrder',
19221910
'addFilterByRequiredOptions',
19231911
'setSelectionIdsFilter',
1924-
'joinPrices',
1925-
'getItems'
1912+
'joinPrices'
19261913
]
19271914
)
19281915
->disableOriginalConstructor()
@@ -1991,9 +1978,6 @@ public function testGetSelectionsByIds()
19911978
->method('setSelectionIdsFilter')
19921979
->with($selectionIds)
19931980
->will($this->returnSelf());
1994-
$usedSelectionsMock->expects($this->once())
1995-
->method('getItems')
1996-
->willReturn($usedSelectionsIds);
19971981

19981982
$usedSelectionsMock->expects($this->once())
19991983
->method('joinPrices')
@@ -2007,96 +1991,6 @@ public function testGetSelectionsByIds()
20071991
$this->model->getSelectionsByIds($selectionIds, $productMock);
20081992
}
20091993

2010-
/**
2011-
* @expectedException \Magento\Framework\Exception\LocalizedException
2012-
* @expectedExceptionMessage The options you selected are not available.
2013-
*
2014-
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
2015-
*/
2016-
public function testGetSelectionsByIdsException()
2017-
{
2018-
$selectionIds = [1, 2, 3];
2019-
$usedSelectionsIds = [4, 5];
2020-
$storeId = 2;
2021-
$storeFilter = 'store_filter';
2022-
$productMock = $this->getMockBuilder('Magento\Catalog\Model\Product')
2023-
->disableOriginalConstructor()
2024-
->getMock();
2025-
$usedSelectionsMock = $this->getMockBuilder('Magento\Bundle\Model\ResourceModel\Selection\Collection')
2026-
->setMethods(
2027-
[
2028-
'addAttributeToSelect',
2029-
'setFlag',
2030-
'addStoreFilter',
2031-
'setStoreId',
2032-
'setPositionOrder',
2033-
'addFilterByRequiredOptions',
2034-
'setSelectionIdsFilter',
2035-
'joinPrices',
2036-
'getItems'
2037-
]
2038-
)
2039-
->disableOriginalConstructor()
2040-
->getMock();
2041-
$productGetMap = [
2042-
['_cache_instance_used_selections', null, null],
2043-
['_cache_instance_used_selections_ids', null, $usedSelectionsIds],
2044-
['_cache_instance_store_filter', null, $storeFilter],
2045-
];
2046-
$productMock->expects($this->any())
2047-
->method('getData')
2048-
->will($this->returnValueMap($productGetMap));
2049-
$productSetMap = [
2050-
['_cache_instance_used_selections', $usedSelectionsMock, $productMock],
2051-
['_cache_instance_used_selections_ids', $selectionIds, $productMock],
2052-
];
2053-
$productMock->expects($this->any())
2054-
->method('setData')
2055-
->will($this->returnValueMap($productSetMap));
2056-
$productMock->expects($this->once())
2057-
->method('getStoreId')
2058-
->will($this->returnValue($storeId));
2059-
2060-
$this->bundleCollection->expects($this->once())
2061-
->method('create')
2062-
->will($this->returnValue($usedSelectionsMock));
2063-
2064-
$usedSelectionsMock->expects($this->once())
2065-
->method('addAttributeToSelect')
2066-
->with('*')
2067-
->will($this->returnSelf());
2068-
$flagMap = [
2069-
['require_stock_items', true, $usedSelectionsMock],
2070-
['product_children', true, $usedSelectionsMock],
2071-
];
2072-
$usedSelectionsMock->expects($this->any())
2073-
->method('setFlag')
2074-
->will($this->returnValueMap($flagMap));
2075-
$usedSelectionsMock->expects($this->once())
2076-
->method('addStoreFilter')
2077-
->with($storeFilter)
2078-
->will($this->returnSelf());
2079-
$usedSelectionsMock->expects($this->once())
2080-
->method('setStoreId')
2081-
->with($storeId)
2082-
->will($this->returnSelf());
2083-
$usedSelectionsMock->expects($this->once())
2084-
->method('setPositionOrder')
2085-
->will($this->returnSelf());
2086-
$usedSelectionsMock->expects($this->once())
2087-
->method('addFilterByRequiredOptions')
2088-
->will($this->returnSelf());
2089-
$usedSelectionsMock->expects($this->once())
2090-
->method('setSelectionIdsFilter')
2091-
->with($selectionIds)
2092-
->will($this->returnSelf());
2093-
$usedSelectionsMock->expects($this->once())
2094-
->method('getItems')
2095-
->willReturn($usedSelectionsIds);
2096-
2097-
2098-
$this->model->getSelectionsByIds($selectionIds, $productMock);
2099-
}
21001994
/**
21011995
* @return void
21021996
*/

app/code/Magento/Bundle/view/frontend/templates/catalog/product/view/type/bundle/option/checkbox.phtml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
type="checkbox"
3232
<?php if ($_option->getRequired()) echo 'data-validate="{\'validate-one-required-by-name\':\'input[name^=&quot;bundle_option[' . $_option->getId() . ']&quot;]:checked\'}"'?>
3333
name="bundle_option[<?php /* @escapeNotVerified */ echo $_option->getId() ?>][<?php /* @escapeNotVerified */ echo $_selection->getId() ?>]"
34+
data-selector="bundle_option[<?php /* @escapeNotVerified */ echo $_option->getId() ?>][<?php /* @escapeNotVerified */ echo $_selection->getId() ?>]"
3435
<?php if ($block->isSelected($_selection)) echo ' checked="checked"' ?>
3536
<?php if (!$_selection->isSaleable()) echo ' disabled="disabled"' ?>
3637
value="<?php /* @escapeNotVerified */ echo $_selection->getSelectionId() ?>"/>

0 commit comments

Comments
 (0)