Skip to content

Commit

Permalink
Merge remote-tracking branch 'mainline/2.2-develop' into MAGETWO-94670
Browse files Browse the repository at this point in the history
  • Loading branch information
duhon committed Oct 16, 2018
2 parents 0a3352c + 448770c commit 3121973
Show file tree
Hide file tree
Showing 354 changed files with 5,681 additions and 7,221 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();
}
}
34 changes: 0 additions & 34 deletions app/code/Magento/Backend/Test/Mftf/composer.json

This file was deleted.

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
6 changes: 2 additions & 4 deletions app/code/Magento/Bundle/Model/Product/Type.php
Original file line number Diff line number Diff line change
Expand Up @@ -1013,10 +1013,8 @@ public function shakeSelections($firstItem, $secondItem)
$secondItem->getPosition(),
$secondItem->getSelectionId(),
];
if ($aPosition == $bPosition) {
return 0;
}
return $aPosition < $bPosition ? -1 : 1;

return $aPosition <=> $bPosition;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,13 +151,7 @@ protected function _construct()
*/
public function _afterLoad()
{
parent::_afterLoad();
if ($this->getStoreId() && $this->_items) {
foreach ($this->_items as $item) {
$item->setStoreId($this->getStoreId());
}
}
return $this;
return parent::_afterLoad();
}

/**
Expand Down Expand Up @@ -356,7 +350,10 @@ public function addPriceFilter($product, $searchMin, $useRegularPrice = false)
}

/**
* Get Catalog Rule Processor.
*
* @return \Magento\CatalogRule\Model\ResourceModel\Product\CollectionProcessor
*
* @deprecated 100.2.0
*/
private function getCatalogRuleProcessor()
Expand Down
1 change: 0 additions & 1 deletion app/code/Magento/Bundle/Test/Mftf/Data/BundleLinkData.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
<entities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/DataGenerator/etc/dataProfileSchema.xsd">
<entity name="ApiBundleLink" type="bundle_link">
<var key="sku" entityKey="sku" entityType="product2"/>
<var key="option_id" entityKey="return" entityType="bundle_option"/>
<var key="sku" entityKey="sku" entityType="product"/>
<data key="qty">1</data>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
<data key="urlKey" unique="suffix">bundleproduct</data>
<data key="visibility">4</data>
<data key="option_title" unique="suffix">TestOption</data>
<data key="input_type" >Drop-down</data>
<data key="default_quantity1" >10</data>
<data key="default_quantity2" >20</data>
<data key="input_type" >Drop-down</data>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,7 @@
<click selector="{{CheckoutCartProductSection.editItemParametersButton('1')}}" stepKey="clickEdit"/>
<waitForPageLoad stepKey="waitForStorefront2"/>

<!-- Choose both of the options on the storefront -->
<click selector="{{StorefrontBundledSection.bundleOption('1','1')}}" stepKey="selectFirstBundleOption2"/>
<!-- Check second one option to choose both of the options on the storefront -->
<click selector="{{StorefrontBundledSection.bundleOption('1','2')}}" stepKey="selectSecondBundleOption2"/>

<waitForPageLoad stepKey="waitForPriceUpdate3"/>
Expand Down
36 changes: 0 additions & 36 deletions app/code/Magento/Bundle/Test/Mftf/composer.json

This file was deleted.

Loading

0 comments on commit 3121973

Please sign in to comment.