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

Commit 8c868c3

Browse files
author
Janak Bhimani
authored
Merge pull request #2 from magento/2.2-develop
2.2 develop
2 parents 332f88f + c9d1bec commit 8c868c3

File tree

537 files changed

+8831
-7797
lines changed

Some content is hidden

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

537 files changed

+8831
-7797
lines changed

app/code/Magento/AdminNotification/Test/Mftf/composer.json

Lines changed: 0 additions & 20 deletions
This file was deleted.

app/code/Magento/AdvancedPricingImportExport/Test/Mftf/composer.json

Lines changed: 0 additions & 23 deletions
This file was deleted.

app/code/Magento/Analytics/Test/Mftf/composer.json

Lines changed: 0 additions & 20 deletions
This file was deleted.

app/code/Magento/Authorization/Test/Mftf/composer.json

Lines changed: 0 additions & 17 deletions
This file was deleted.

app/code/Magento/Authorizenet/Test/Mftf/composer.json

Lines changed: 0 additions & 25 deletions
This file was deleted.

app/code/Magento/Backend/Block/Widget/Button/ButtonList.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -127,12 +127,6 @@ public function getItems()
127127
*/
128128
public function sortButtons(Item $itemA, Item $itemB)
129129
{
130-
$sortOrderA = (int) $itemA->getSortOrder();
131-
$sortOrderB = (int) $itemB->getSortOrder();
132-
133-
if ($sortOrderA == $sortOrderB) {
134-
return 0;
135-
}
136-
return ($sortOrderA < $sortOrderB) ? -1 : 1;
130+
return (int)$itemA->getSortOrder() <=> (int)$itemB->getSortOrder();
137131
}
138132
}

app/code/Magento/Backend/Model/Menu.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public function add(Item $item, $parentId = null, $index = null)
8383
}
8484
$parentItem->getChildren()->add($item, null, $index);
8585
} else {
86-
$index = (int) $index;
86+
$index = (int)$index;
8787
if (!isset($this[$index])) {
8888
$this->offsetSet($index, $item);
8989
$this->_logger->info(
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/actionGroupSchema.xsd">
10+
<actionGroup name="NavigateToConfigurationGeneralPage">
11+
<amOnPage url="{{AdminConfigGeneralPage.url}}" stepKey="navigateToConfigGeneralPage"/>
12+
<waitForPageLoad stepKey="waitForConfigPageLoad"/>
13+
</actionGroup>
14+
15+
<actionGroup name="SelectTopDestinationsCountry">
16+
<arguments>
17+
<argument name="countries"/>
18+
</arguments>
19+
<amOnPage url="{{AdminConfigurationGeneralSectionPage.url('#general_country-link')}}" stepKey="goToConfigurationSectionPage"/>
20+
<selectOption selector="{{AdminConfigurationGeneralSectionCountryOptionsGroupSection.topDestinations}}" parameterArray="[{{countries.country}}]" stepKey="selectTopDestinationsCountry"/>
21+
<click selector="{{AdminMainActionsSection.save}}" stepKey="saveConfiguration"/>
22+
<see userInput="You saved the configuration." stepKey="seeSuccessMessage"/>
23+
</actionGroup>
24+
25+
<actionGroup name="UnSelectTopDestinationsCountry">
26+
<arguments>
27+
<argument name="countries"/>
28+
</arguments>
29+
<amOnPage url="{{AdminConfigurationGeneralSectionPage.url('#general_country-link')}}" stepKey="goToConfigurationSectionPage"/>
30+
<unselectOption selector="{{AdminConfigurationGeneralSectionCountryOptionsGroupSection.topDestinations}}" parameterArray="[{{countries.country}}]" stepKey="unSelectTopDestinationsCountry"/>
31+
<click selector="{{AdminMainActionsSection.save}}" stepKey="saveConfiguration"/>
32+
<see userInput="You saved the configuration." stepKey="seeSuccessMessage"/>
33+
</actionGroup>
34+
</actionGroups>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<!--
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
-->
7+
<pages xsi:noNamespaceSchemaLocation="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/PageObject.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
8+
<page name="AdminConfigurationGeneralSectionPage" url="admin/system_config/edit/section/general/{{group_anchor}}" parameterized="true" area="admin" module="Magento_Config">
9+
<section name="AdminConfigurationGeneralSectionCountryOptionsGroupSection"/>
10+
</page>
11+
</pages>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<!--
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
-->
7+
<sections xsi:noNamespaceSchemaLocation="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/SectionObject.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
8+
<section name="AdminConfigurationGeneralSectionCountryOptionsGroupSection">
9+
<element name="topDestinations" type="multiselect" selector="#general_country_destinations"/>
10+
</section>
11+
</sections>

app/code/Magento/Backend/Test/Mftf/composer.json

Lines changed: 0 additions & 34 deletions
This file was deleted.

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,7 @@
218218
<field id="destinations" translate="label" type="multiselect" sortOrder="40" showInDefault="1" showInWebsite="1" showInStore="1">
219219
<label>Top destinations</label>
220220
<source_model>Magento\Directory\Model\Config\Source\Country</source_model>
221+
<can_be_empty>1</can_be_empty>
221222
</field>
222223
</group>
223224
<group id="locale" translate="label" type="text" sortOrder="8" showInDefault="1" showInWebsite="1" showInStore="1">

app/code/Magento/Backup/Model/Config/Backend/Cron.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,11 @@ public function afterSave()
7676

7777
if ($enabled) {
7878
$cronExprArray = [
79-
(int) $time[1], # Minute
80-
(int) $time[0], # Hour
81-
$frequency == $frequencyMonthly ? '1' : '*', # Day of the Month
82-
'*', # Month of the Year
83-
$frequency == $frequencyWeekly ? '1' : '*', # Day of the Week
79+
(int)$time[1], # Minute
80+
(int)$time[0], # Hour
81+
$frequency == $frequencyMonthly ? '1' : '*', # Day of the Month
82+
'*', # Month of the Year
83+
$frequency == $frequencyWeekly ? '1' : '*', # Day of the Week
8484
];
8585
$cronExprString = implode(' ', $cronExprArray);
8686
} else {

app/code/Magento/Backup/Test/Mftf/composer.json

Lines changed: 0 additions & 19 deletions
This file was deleted.

app/code/Magento/Braintree/Test/Mftf/composer.json

Lines changed: 0 additions & 33 deletions
This file was deleted.

app/code/Magento/Bundle/Block/Catalog/Product/View/Type/Bundle.php

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
use Magento\Bundle\Model\Option;
99
use Magento\Catalog\Model\Product;
10+
use Magento\Framework\DataObject;
1011

1112
/**
1213
* Catalog bundle product info block
@@ -166,7 +167,7 @@ public function getJsonConfig()
166167

167168
$defaultValues = [];
168169
$preConfiguredFlag = $currentProduct->hasPreconfiguredValues();
169-
/** @var \Magento\Framework\DataObject|null $preConfiguredValues */
170+
/** @var DataObject|null $preConfiguredValues */
170171
$preConfiguredValues = $preConfiguredFlag ? $currentProduct->getPreconfiguredValues() : null;
171172

172173
$position = 0;
@@ -185,12 +186,13 @@ public function getJsonConfig()
185186
if ($configValue) {
186187
$defaultValues[$optionId] = $configValue;
187188
}
189+
$options = $this->processOptions($optionId, $options, $preConfiguredValues);
188190
}
189191
$position++;
190192
}
191193
$config = $this->getConfigData($currentProduct, $options);
192194

193-
$configObj = new \Magento\Framework\DataObject(
195+
$configObj = new DataObject(
194196
[
195197
'config' => $config,
196198
]
@@ -393,4 +395,30 @@ private function getConfigData(Product $product, array $options)
393395
];
394396
return $config;
395397
}
398+
399+
/**
400+
* Set preconfigured quantities and selections to options.
401+
*
402+
* @param string $optionId
403+
* @param array $options
404+
* @param DataObject $preConfiguredValues
405+
* @return array
406+
*/
407+
private function processOptions(string $optionId, array $options, DataObject $preConfiguredValues)
408+
{
409+
$preConfiguredQtys = $preConfiguredValues->getData("bundle_option_qty/${optionId}") ?? [];
410+
$selections = $options[$optionId]['selections'];
411+
array_walk($selections, function (&$selection, $selectionId) use ($preConfiguredQtys) {
412+
if (is_array($preConfiguredQtys) && isset($preConfiguredQtys[$selectionId])) {
413+
$selection['qty'] = $preConfiguredQtys[$selectionId];
414+
} else {
415+
if ((int)$preConfiguredQtys > 0) {
416+
$selection['qty'] = $preConfiguredQtys;
417+
}
418+
}
419+
});
420+
$options[$optionId]['selections'] = $selections;
421+
422+
return $options;
423+
}
396424
}

app/code/Magento/Bundle/Block/Catalog/Product/View/Type/Bundle/Option.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,9 @@ protected function _getSelectedOptions()
169169
*/
170170
protected function assignSelection(\Magento\Bundle\Model\Option $option, $selectionId)
171171
{
172-
if ($selectionId && $option->getSelectionById($selectionId)) {
172+
if (is_array($selectionId)) {
173+
$this->_selectedOptions = $selectionId;
174+
} else if ($selectionId && $option->getSelectionById($selectionId)) {
173175
$this->_selectedOptions = $selectionId;
174176
} elseif (!$option->getRequired()) {
175177
$this->_selectedOptions = 'None';

0 commit comments

Comments
 (0)