Skip to content

Commit c52e0cb

Browse files
committed
Merge branch '2.3-develop' of github.com:magento/magento2ce into MAGETWO-93678
2 parents dc0827a + a5107ab commit c52e0cb

File tree

64 files changed

+435
-403
lines changed

Some content is hidden

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

64 files changed

+435
-403
lines changed

app/code/Magento/Catalog/Model/Product/Type/AbstractType.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -292,13 +292,7 @@ public function attributesCompare($attributeOne, $attributeTwo)
292292
$sortOne = $attributeOne->getGroupSortPath() * 1000 + $attributeOne->getSortPath() * 0.0001;
293293
$sortTwo = $attributeTwo->getGroupSortPath() * 1000 + $attributeTwo->getSortPath() * 0.0001;
294294

295-
if ($sortOne > $sortTwo) {
296-
return 1;
297-
} elseif ($sortOne < $sortTwo) {
298-
return -1;
299-
}
300-
301-
return 0;
295+
return $sortOne <=> $sortTwo;
302296
}
303297

304298
/**

app/code/Magento/Checkout/Test/Mftf/Section/CheckoutPaymentSection.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<element name="isPaymentSection" type="text" selector="//*[@class='opc-progress-bar']/li[contains(@class, '_active') and span[contains(.,'Review &amp; Payments')]]"/>
1313
<element name="availablePaymentSolutions" type="text" selector="#checkout-payment-method-load>div>div>div:nth-child(2)>div.payment-method-title.field.choice"/>
1414
<element name="notAvailablePaymentSolutions" type="text" selector="#checkout-payment-method-load>div>div>div.payment-method._active>div.payment-method-title.field.choice"/>
15-
<element name="billingNewAddressForm" type="text" selector=".billing-new-address-form"/>
15+
<element name="billingNewAddressForm" type="text" selector="[data-form='billing-new-address']"/>
1616
<element name="placeOrderDisabled" type="button" selector="#checkout-payment-method-load button.disabled"/>
1717
<element name="update" type="button" selector=".payment-method-billing-address .action.action-update"/>
1818
<element name="guestFirstName" type="input" selector=".billing-address-form input[name*='firstname']"/>

app/code/Magento/Checkout/view/frontend/web/js/model/cart/totals-processor/default.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ define([
3838
payload.addressInformation['shipping_carrier_code'] = quote.shippingMethod()['carrier_code'];
3939
}
4040

41-
storage.post(
41+
return storage.post(
4242
serviceUrl, JSON.stringify(payload), false
4343
).done(function (result) {
4444
var data = {
@@ -96,7 +96,7 @@ define([
9696
) {
9797
quote.setTotals(cartCache.get('totals'));
9898
} else {
99-
loadFromServer(address);
99+
return loadFromServer(address);
100100
}
101101
}
102102
};

app/code/Magento/Checkout/view/frontend/web/template/billing-address/form.html

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@
99
<!-- ko template: getTemplate() --><!-- /ko -->
1010
<!--/ko-->
1111
<form data-bind="attr: {'data-hasrequired': $t('* Required Fields')}">
12-
<fieldset data-bind="attr: { id:'billing-new-address-form-'+index, value:index}"
13-
class="billing-new-address-form fieldset address">
12+
<fieldset class="fieldset address" data-form="billing-new-address">
1413
<!-- ko foreach: getRegion('additional-fieldsets') -->
1514
<!-- ko template: getTemplate() --><!-- /ko -->
1615
<!--/ko-->

app/code/Magento/Eav/Model/Entity/AbstractEntity.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -591,13 +591,7 @@ public function attributesCompare($firstAttribute, $secondAttribute)
591591
$firstSort = $firstAttribute->getSortWeight((int) $this->_sortingSetId);
592592
$secondSort = $secondAttribute->getSortWeight((int) $this->_sortingSetId);
593593

594-
if ($firstSort > $secondSort) {
595-
return 1;
596-
} elseif ($firstSort < $secondSort) {
597-
return -1;
598-
}
599-
600-
return 0;
594+
return $firstSort <=> $secondSort;
601595
}
602596

603597
/**

app/code/Magento/Quote/Model/Quote/Address.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -872,13 +872,7 @@ public function getGroupedAllShippingRates()
872872
*/
873873
protected function _sortRates($firstItem, $secondItem)
874874
{
875-
if ((int)$firstItem[0]->carrier_sort_order < (int)$secondItem[0]->carrier_sort_order) {
876-
return -1;
877-
} elseif ((int)$firstItem[0]->carrier_sort_order > (int)$secondItem[0]->carrier_sort_order) {
878-
return 1;
879-
} else {
880-
return 0;
881-
}
875+
return (int) $firstItem[0]->carrier_sort_order <=> (int) $secondItem[0]->carrier_sort_order;
882876
}
883877

884878
/**

app/code/Magento/Sales/Model/Config/Ordered.php

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -167,13 +167,8 @@ function ($a, $b) {
167167
if (!isset($a['sort_order']) || !isset($b['sort_order'])) {
168168
return 0;
169169
}
170-
if ($a['sort_order'] > $b['sort_order']) {
171-
return 1;
172-
} elseif ($a['sort_order'] < $b['sort_order']) {
173-
return -1;
174-
} else {
175-
return 0;
176-
}
170+
171+
return $a['sort_order'] <=> $b['sort_order'];
177172
}
178173
);
179174
}

dev/tests/integration/testsuite/Magento/Catalog/_files/multiselect_attribute.php

Lines changed: 43 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -12,45 +12,48 @@
1212
$attribute = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
1313
\Magento\Catalog\Model\ResourceModel\Eav\Attribute::class
1414
);
15-
$attribute->setData(
16-
[
17-
'attribute_code' => 'multiselect_attribute',
18-
'entity_type_id' => $installer->getEntityTypeId('catalog_product'),
19-
'is_global' => 1,
20-
'is_user_defined' => 1,
21-
'frontend_input' => 'multiselect',
22-
'is_unique' => 0,
23-
'is_required' => 0,
24-
'is_searchable' => 0,
25-
'is_visible_in_advanced_search' => 0,
26-
'is_comparable' => 0,
27-
'is_filterable' => 1,
28-
'is_filterable_in_search' => 0,
29-
'is_used_for_promo_rules' => 0,
30-
'is_html_allowed_on_front' => 1,
31-
'is_visible_on_front' => 0,
32-
'used_in_product_listing' => 0,
33-
'used_for_sort_by' => 0,
34-
'frontend_label' => ['Multiselect Attribute'],
35-
'backend_type' => 'varchar',
36-
'backend_model' => \Magento\Eav\Model\Entity\Attribute\Backend\ArrayBackend::class,
37-
'option' => [
38-
'value' => [
39-
'option_1' => ['Option 1'],
40-
'option_2' => ['Option 2'],
41-
'option_3' => ['Option 3'],
42-
'option_4' => ['Option 4 "!@#$%^&*']
15+
$entityType = $installer->getEntityTypeId('catalog_product');
16+
if (!$attribute->loadByCode($entityType, 'multiselect_attribute')->getAttributeId()) {
17+
$attribute->setData(
18+
[
19+
'attribute_code' => 'multiselect_attribute',
20+
'entity_type_id' => $entityType,
21+
'is_global' => 1,
22+
'is_user_defined' => 1,
23+
'frontend_input' => 'multiselect',
24+
'is_unique' => 0,
25+
'is_required' => 0,
26+
'is_searchable' => 0,
27+
'is_visible_in_advanced_search' => 0,
28+
'is_comparable' => 0,
29+
'is_filterable' => 1,
30+
'is_filterable_in_search' => 0,
31+
'is_used_for_promo_rules' => 0,
32+
'is_html_allowed_on_front' => 1,
33+
'is_visible_on_front' => 0,
34+
'used_in_product_listing' => 0,
35+
'used_for_sort_by' => 0,
36+
'frontend_label' => ['Multiselect Attribute'],
37+
'backend_type' => 'varchar',
38+
'backend_model' => \Magento\Eav\Model\Entity\Attribute\Backend\ArrayBackend::class,
39+
'option' => [
40+
'value' => [
41+
'option_1' => ['Option 1'],
42+
'option_2' => ['Option 2'],
43+
'option_3' => ['Option 3'],
44+
'option_4' => ['Option 4 "!@#$%^&*']
45+
],
46+
'order' => [
47+
'option_1' => 1,
48+
'option_2' => 2,
49+
'option_3' => 3,
50+
'option_4' => 4,
51+
],
4352
],
44-
'order' => [
45-
'option_1' => 1,
46-
'option_2' => 2,
47-
'option_3' => 3,
48-
'option_4' => 4,
49-
],
50-
],
51-
]
52-
);
53-
$attribute->save();
53+
]
54+
);
55+
$attribute->save();
5456

55-
/* Assign attribute to attribute set */
56-
$installer->addAttributeToGroup('catalog_product', 'Default', 'General', $attribute->getId());
57+
/* Assign attribute to attribute set */
58+
$installer->addAttributeToGroup('catalog_product', 'Default', 'General', $attribute->getId());
59+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
/**
9+
* Create multiselect attribute
10+
*/
11+
require __DIR__ . '/multiselect_attribute.php';
12+
13+
/** Create product with options out of stock and multiselect attribute */
14+
15+
/** @var $installer \Magento\Catalog\Setup\CategorySetup */
16+
$installer = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
17+
\Magento\Catalog\Setup\CategorySetup::class
18+
);
19+
20+
/** @var $options \Magento\Eav\Model\ResourceModel\Entity\Attribute\Option\Collection */
21+
$options = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
22+
\Magento\Eav\Model\ResourceModel\Entity\Attribute\Option\Collection::class
23+
);
24+
$options->setAttributeFilter($attribute->getId());
25+
$optionIds = $options->getAllIds();
26+
27+
$product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(\Magento\Catalog\Model\Product::class);
28+
$product->setTypeId(\Magento\Catalog\Model\Product\Type::TYPE_SIMPLE)
29+
->setId($optionIds[1] * 20)
30+
->setAttributeSetId($installer->getAttributeSetId('catalog_product', 'Default'))
31+
->setWebsiteIds([1])
32+
->setName('Out of Stock With Multiselect')
33+
->setSku('simple_ms_out_of_stock')
34+
->setPrice(10)
35+
->setVisibility(\Magento\Catalog\Model\Product\Visibility::VISIBILITY_BOTH)
36+
->setMultiselectAttribute([$optionIds[1], $optionIds[2], $optionIds[3]])
37+
->setStatus(\Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED)
38+
->setStockData(['use_config_manage_stock' => 1, 'qty' => 0,'is_in_stock' => 0])
39+
->save();
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
require __DIR__ . '/multiselect_attribute_rollback.php';
9+
10+
use Magento\Framework\Exception\NoSuchEntityException;
11+
use Magento\Framework\Indexer\IndexerRegistry;
12+
13+
/** @var \Magento\Framework\Registry $registry */
14+
$registry = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get(\Magento\Framework\Registry::class);
15+
16+
$registry->unregister('isSecureArea');
17+
$registry->register('isSecureArea', true);
18+
19+
/** @var \Magento\Catalog\Api\ProductRepositoryInterface $productRepository */
20+
$productRepository = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
21+
->get(\Magento\Catalog\Api\ProductRepositoryInterface::class);
22+
try {
23+
$product = $productRepository->get('simple_ms_out_of_stock', false, null, true);
24+
$productRepository->delete($product);
25+
} catch (NoSuchEntityException $e) {
26+
}
27+
28+
\Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get(IndexerRegistry::class)
29+
->get(Magento\CatalogInventory\Model\Indexer\Stock\Processor::INDEXER_ID)
30+
->reindexAll();
31+
32+
$registry->unregister('isSecureArea');
33+
$registry->register('isSecureArea', false);

dev/tests/integration/testsuite/Magento/Catalog/_files/products_with_multiselect_attribute_rollback.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
67
require __DIR__ . '/multiselect_attribute_rollback.php';
8+
9+
use Magento\Framework\Indexer\IndexerRegistry;
10+
711
/**
812
* Remove all products as strategy of isolation process
913
*/
@@ -22,3 +26,7 @@
2226

2327
$registry->unregister('isSecureArea');
2428
$registry->register('isSecureArea', false);
29+
30+
\Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get(IndexerRegistry::class)
31+
->get(Magento\CatalogInventory\Model\Indexer\Stock\Processor::INDEXER_ID)
32+
->reindexAll();

0 commit comments

Comments
 (0)