Skip to content

Commit

Permalink
Merge pull request #2 from magento/2.2-develop
Browse files Browse the repository at this point in the history
2.2 develop
  • Loading branch information
Janak Bhimani authored Oct 16, 2018
2 parents 332f88f + c9d1bec commit 8c868c3
Show file tree
Hide file tree
Showing 537 changed files with 8,831 additions and 7,797 deletions.
20 changes: 0 additions & 20 deletions app/code/Magento/AdminNotification/Test/Mftf/composer.json

This file was deleted.

This file was deleted.

20 changes: 0 additions & 20 deletions app/code/Magento/Analytics/Test/Mftf/composer.json

This file was deleted.

17 changes: 0 additions & 17 deletions app/code/Magento/Authorization/Test/Mftf/composer.json

This file was deleted.

25 changes: 0 additions & 25 deletions app/code/Magento/Authorizenet/Test/Mftf/composer.json

This file was deleted.

8 changes: 1 addition & 7 deletions app/code/Magento/Backend/Block/Widget/Button/ButtonList.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,12 +127,6 @@ public function getItems()
*/
public function sortButtons(Item $itemA, Item $itemB)
{
$sortOrderA = (int) $itemA->getSortOrder();
$sortOrderB = (int) $itemB->getSortOrder();

if ($sortOrderA == $sortOrderB) {
return 0;
}
return ($sortOrderA < $sortOrderB) ? -1 : 1;
return (int)$itemA->getSortOrder() <=> (int)$itemB->getSortOrder();
}
}
2 changes: 1 addition & 1 deletion app/code/Magento/Backend/Model/Menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public function add(Item $item, $parentId = null, $index = null)
}
$parentItem->getChildren()->add($item, null, $index);
} else {
$index = (int) $index;
$index = (int)$index;
if (!isset($this[$index])) {
$this->offsetSet($index, $item);
$this->_logger->info(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<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">
<actionGroup name="NavigateToConfigurationGeneralPage">
<amOnPage url="{{AdminConfigGeneralPage.url}}" stepKey="navigateToConfigGeneralPage"/>
<waitForPageLoad stepKey="waitForConfigPageLoad"/>
</actionGroup>

<actionGroup name="SelectTopDestinationsCountry">
<arguments>
<argument name="countries"/>
</arguments>
<amOnPage url="{{AdminConfigurationGeneralSectionPage.url('#general_country-link')}}" stepKey="goToConfigurationSectionPage"/>
<selectOption selector="{{AdminConfigurationGeneralSectionCountryOptionsGroupSection.topDestinations}}" parameterArray="[{{countries.country}}]" stepKey="selectTopDestinationsCountry"/>
<click selector="{{AdminMainActionsSection.save}}" stepKey="saveConfiguration"/>
<see userInput="You saved the configuration." stepKey="seeSuccessMessage"/>
</actionGroup>

<actionGroup name="UnSelectTopDestinationsCountry">
<arguments>
<argument name="countries"/>
</arguments>
<amOnPage url="{{AdminConfigurationGeneralSectionPage.url('#general_country-link')}}" stepKey="goToConfigurationSectionPage"/>
<unselectOption selector="{{AdminConfigurationGeneralSectionCountryOptionsGroupSection.topDestinations}}" parameterArray="[{{countries.country}}]" stepKey="unSelectTopDestinationsCountry"/>
<click selector="{{AdminMainActionsSection.save}}" stepKey="saveConfiguration"/>
<see userInput="You saved the configuration." stepKey="seeSuccessMessage"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<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">
<page name="AdminConfigurationGeneralSectionPage" url="admin/system_config/edit/section/general/{{group_anchor}}" parameterized="true" area="admin" module="Magento_Config">
<section name="AdminConfigurationGeneralSectionCountryOptionsGroupSection"/>
</page>
</pages>
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<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">
<section name="AdminConfigurationGeneralSectionCountryOptionsGroupSection">
<element name="topDestinations" type="multiselect" selector="#general_country_destinations"/>
</section>
</sections>
34 changes: 0 additions & 34 deletions app/code/Magento/Backend/Test/Mftf/composer.json

This file was deleted.

1 change: 1 addition & 0 deletions app/code/Magento/Backend/etc/adminhtml/system.xml
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@
<field id="destinations" translate="label" type="multiselect" sortOrder="40" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Top destinations</label>
<source_model>Magento\Directory\Model\Config\Source\Country</source_model>
<can_be_empty>1</can_be_empty>
</field>
</group>
<group id="locale" translate="label" type="text" sortOrder="8" showInDefault="1" showInWebsite="1" showInStore="1">
Expand Down
10 changes: 5 additions & 5 deletions app/code/Magento/Backup/Model/Config/Backend/Cron.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,11 @@ public function afterSave()

if ($enabled) {
$cronExprArray = [
(int) $time[1], # Minute
(int) $time[0], # Hour
$frequency == $frequencyMonthly ? '1' : '*', # Day of the Month
'*', # Month of the Year
$frequency == $frequencyWeekly ? '1' : '*', # Day of the Week
(int)$time[1], # Minute
(int)$time[0], # Hour
$frequency == $frequencyMonthly ? '1' : '*', # Day of the Month
'*', # Month of the Year
$frequency == $frequencyWeekly ? '1' : '*', # Day of the Week
];
$cronExprString = implode(' ', $cronExprArray);
} else {
Expand Down
19 changes: 0 additions & 19 deletions app/code/Magento/Backup/Test/Mftf/composer.json

This file was deleted.

33 changes: 0 additions & 33 deletions app/code/Magento/Braintree/Test/Mftf/composer.json

This file was deleted.

32 changes: 30 additions & 2 deletions app/code/Magento/Bundle/Block/Catalog/Product/View/Type/Bundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

use Magento\Bundle\Model\Option;
use Magento\Catalog\Model\Product;
use Magento\Framework\DataObject;

/**
* Catalog bundle product info block
Expand Down Expand Up @@ -166,7 +167,7 @@ public function getJsonConfig()

$defaultValues = [];
$preConfiguredFlag = $currentProduct->hasPreconfiguredValues();
/** @var \Magento\Framework\DataObject|null $preConfiguredValues */
/** @var DataObject|null $preConfiguredValues */
$preConfiguredValues = $preConfiguredFlag ? $currentProduct->getPreconfiguredValues() : null;

$position = 0;
Expand All @@ -185,12 +186,13 @@ public function getJsonConfig()
if ($configValue) {
$defaultValues[$optionId] = $configValue;
}
$options = $this->processOptions($optionId, $options, $preConfiguredValues);
}
$position++;
}
$config = $this->getConfigData($currentProduct, $options);

$configObj = new \Magento\Framework\DataObject(
$configObj = new DataObject(
[
'config' => $config,
]
Expand Down Expand Up @@ -393,4 +395,30 @@ private function getConfigData(Product $product, array $options)
];
return $config;
}

/**
* Set preconfigured quantities and selections to options.
*
* @param string $optionId
* @param array $options
* @param DataObject $preConfiguredValues
* @return array
*/
private function processOptions(string $optionId, array $options, DataObject $preConfiguredValues)
{
$preConfiguredQtys = $preConfiguredValues->getData("bundle_option_qty/${optionId}") ?? [];
$selections = $options[$optionId]['selections'];
array_walk($selections, function (&$selection, $selectionId) use ($preConfiguredQtys) {
if (is_array($preConfiguredQtys) && isset($preConfiguredQtys[$selectionId])) {
$selection['qty'] = $preConfiguredQtys[$selectionId];
} else {
if ((int)$preConfiguredQtys > 0) {
$selection['qty'] = $preConfiguredQtys;
}
}
});
$options[$optionId]['selections'] = $selections;

return $options;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,9 @@ protected function _getSelectedOptions()
*/
protected function assignSelection(\Magento\Bundle\Model\Option $option, $selectionId)
{
if ($selectionId && $option->getSelectionById($selectionId)) {
if (is_array($selectionId)) {
$this->_selectedOptions = $selectionId;
} else if ($selectionId && $option->getSelectionById($selectionId)) {
$this->_selectedOptions = $selectionId;
} elseif (!$option->getRequired()) {
$this->_selectedOptions = 'None';
Expand Down
Loading

0 comments on commit 8c868c3

Please sign in to comment.