Skip to content

Commit 9e1f07d

Browse files
authored
Merge branch '2.4-develop' into patch-2
2 parents df37cdd + 46fe3fe commit 9e1f07d

File tree

71 files changed

+1603
-1642
lines changed

Some content is hidden

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

71 files changed

+1603
-1642
lines changed

app/code/Magento/AsynchronousOperations/Controller/Adminhtml/Notification/Dismiss.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@
88
use Magento\AsynchronousOperations\Model\BulkNotificationManagement;
99
use Magento\Backend\App\Action\Context;
1010
use Magento\Backend\App\Action;
11-
use Magento\Framework\App\Action\HttpGetActionInterface;
11+
use Magento\Framework\App\Action\HttpPostActionInterface;
1212
use Magento\Framework\Controller\ResultFactory;
1313

1414
/**
1515
* Class Bulk Notification Dismiss Controller
1616
*/
17-
class Dismiss extends Action implements HttpGetActionInterface
17+
class Dismiss extends Action implements HttpPostActionInterface
1818
{
1919
/**
2020
* @var BulkNotificationManagement
@@ -56,7 +56,7 @@ public function execute()
5656
$isAcknowledged = $this->notificationManagement->acknowledgeBulks($bulkUuids);
5757

5858
/** @var \Magento\Framework\Controller\Result\Json $result */
59-
$result = $this->resultFactory->create(ResultFactory::TYPE_RAW);
59+
$result = $this->resultFactory->create(ResultFactory::TYPE_JSON)->setData(['']);
6060
if (!$isAcknowledged) {
6161
$result->setHttpResponseCode(400);
6262
}

app/code/Magento/AsynchronousOperations/Test/Unit/Controller/Adminhtml/Notification/DismissTest.php

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
use Magento\AsynchronousOperations\Model\BulkNotificationManagement;
1212
use Magento\Framework\App\RequestInterface;
1313
use Magento\Framework\Controller\Result\Json;
14-
use Magento\Framework\Controller\Result\Raw;
1514
use Magento\Framework\Controller\ResultFactory;
1615
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
1716
use PHPUnit\Framework\MockObject\MockObject;
@@ -44,11 +43,6 @@ class DismissTest extends TestCase
4443
*/
4544
private $jsonResultMock;
4645

47-
/**
48-
* @var MockObject
49-
*/
50-
private $rawResultMock;
51-
5246
protected function setUp(): void
5347
{
5448
$objectManager = new ObjectManager($this);
@@ -84,10 +78,15 @@ public function testExecute()
8478

8579
$this->resultFactoryMock->expects($this->once())
8680
->method('create')
87-
->with(ResultFactory::TYPE_RAW, [])
88-
->willReturn($this->rawResultMock);
81+
->with(ResultFactory::TYPE_JSON, [])
82+
->willReturn($this->jsonResultMock);
83+
84+
$this->jsonResultMock->expects($this->once())
85+
->method('setData')
86+
->with([''])
87+
->willReturn($this->jsonResultMock);
8988

90-
$this->assertEquals($this->rawResultMock, $this->model->execute());
89+
$this->assertEquals($this->jsonResultMock, $this->model->execute());
9190
}
9291

9392
public function testExecuteSetsBadRequestResponseStatusIfBulkWasNotAcknowledgedCorrectly()
@@ -101,7 +100,12 @@ public function testExecuteSetsBadRequestResponseStatusIfBulkWasNotAcknowledgedC
101100

102101
$this->resultFactoryMock->expects($this->once())
103102
->method('create')
104-
->with(ResultFactory::TYPE_RAW, [])
103+
->with(ResultFactory::TYPE_JSON, [])
104+
->willReturn($this->jsonResultMock);
105+
106+
$this->jsonResultMock->expects($this->once())
107+
->method('setData')
108+
->with([''])
105109
->willReturn($this->jsonResultMock);
106110

107111
$this->notificationManagementMock->expects($this->once())

app/code/Magento/Catalog/Model/Product/Attribute/Backend/Sku.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,12 @@ public function validate($object)
5656
);
5757
}
5858

59+
if (strcasecmp($attrCode, 'sku') >= 0 && strlen($value) === 0) {
60+
throw new LocalizedException(
61+
__('The "%1" attribute value is empty.', $attrCode)
62+
);
63+
}
64+
5965
if ($this->string->strlen($object->getSku()) > self::SKU_MAX_LENGTH) {
6066
throw new LocalizedException(
6167
__('SKU length should be %1 characters maximum.', self::SKU_MAX_LENGTH)

app/code/Magento/Catalog/Pricing/Price/CalculateCustomOptionCatalogRule.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,7 @@ public function execute(
6868
$regularPrice + $optionPrice,
6969
$product
7070
);
71-
$finalOptionPrice = $totalCatalogRulePrice - $catalogRulePrice;
72-
return $this->priceCurrency->convertAndRound($finalOptionPrice);
71+
return $totalCatalogRulePrice - $catalogRulePrice;
7372
}
7473

7574
return null;

app/code/Magento/Catalog/Test/Mftf/Test/AdminAddImageToWYSIWYGCatalogTest.xml

Lines changed: 28 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,6 @@
88
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
99
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
1010
<test name="AdminAddImageToWYSIWYGCatalogTest">
11-
<before>
12-
<actionGroup ref="AdminLoginActionGroup" stepKey="login"/>
13-
<actionGroup ref="EnabledWYSIWYGActionGroup" stepKey="enableWYSIWYG"/>
14-
<actionGroup ref="CliEnableTinyMCEActionGroup" stepKey="enableTinyMCE" />
15-
</before>
1611
<annotations>
1712
<features value="Catalog"/>
1813
<stories value="MAGETWO-42041-Default WYSIWYG toolbar configuration with Magento Media Gallery"/>
@@ -22,6 +17,34 @@
2217
<severity value="CRITICAL"/>
2318
<testCaseId value="MAGETWO-84373"/>
2419
</annotations>
20+
<before>
21+
<actionGroup ref="AdminLoginActionGroup" stepKey="login"/>
22+
<actionGroup ref="AdminMediaGalleryEnhancedEnableActionGroup" stepKey="enableOldMediaGallery">
23+
<argument name="enabled" value="0"/>
24+
</actionGroup>
25+
<actionGroup ref="EnabledWYSIWYGActionGroup" stepKey="enableWYSIWYG"/>
26+
<actionGroup ref="CliEnableTinyMCEActionGroup" stepKey="enableTinyMCE" />
27+
</before>
28+
<after>
29+
<actionGroup ref="NavigateToMediaGalleryActionGroup" stepKey="navigateToMediaGallery"/>
30+
<actionGroup ref="AdminExpandMediaGalleryFolderActionGroup" stepKey="expandStorageRootFolder">
31+
<argument name="FolderName" value="Storage Root"/>
32+
</actionGroup>
33+
<actionGroup ref="AdminExpandMediaGalleryFolderActionGroup" stepKey="expandWysiwygFolder">
34+
<argument name="FolderName" value="wysiwyg"/>
35+
</actionGroup>
36+
<actionGroup ref="DeleteFolderActionGroup" stepKey="DeleteCreatedFolder">
37+
<argument name="ImageFolder" value="ImageFolder"/>
38+
</actionGroup>
39+
<actionGroup ref="DeleteCategoryActionGroup" stepKey="DeleteCategory">
40+
<argument name="categoryEntity" value="SimpleSubCategory"/>
41+
</actionGroup>
42+
<actionGroup ref="DisabledWYSIWYGActionGroup" stepKey="disableWYSIWYG"/>
43+
<actionGroup ref="AdminMediaGalleryEnhancedEnableActionGroup" stepKey="disableOldMediaGallery">
44+
<argument name="enabled" value="1"/>
45+
</actionGroup>
46+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
47+
</after>
2548
<actionGroup ref="AdminOpenCategoryPageActionGroup" stepKey="navigateToNewCatalog"/>
2649
<comment userInput="BIC workaround" stepKey="wait2"/>
2750
<click selector="{{AdminCategorySidebarActionSection.AddSubcategoryButton}}" stepKey="clickOnAddSubCategory"/>
@@ -57,22 +80,5 @@
5780
<waitForPageLoad stepKey="waitForPageLoad2"/>
5881
<seeElement selector="{{StorefrontCategoryMainSection.mediaDescription(ImageUpload3.content)}}" stepKey="assertMediaDescription"/>
5982
<seeElementInDOM selector="{{StorefrontCategoryMainSection.imageSource(ImageUpload3.fileName)}}" stepKey="assertMediaSource"/>
60-
<after>
61-
<actionGroup ref="NavigateToMediaGalleryActionGroup" stepKey="navigateToMediaGallery"/>
62-
<actionGroup ref="AdminExpandMediaGalleryFolderActionGroup" stepKey="expandStorageRootFolder">
63-
<argument name="FolderName" value="Storage Root"/>
64-
</actionGroup>
65-
<actionGroup ref="AdminExpandMediaGalleryFolderActionGroup" stepKey="expandWysiwygFolder">
66-
<argument name="FolderName" value="wysiwyg"/>
67-
</actionGroup>
68-
<actionGroup ref="DeleteFolderActionGroup" stepKey="DeleteCreatedFolder">
69-
<argument name="ImageFolder" value="ImageFolder"/>
70-
</actionGroup>
71-
<actionGroup ref="DeleteCategoryActionGroup" stepKey="DeleteCategory">
72-
<argument name="categoryEntity" value="SimpleSubCategory"/>
73-
</actionGroup>
74-
<actionGroup ref="DisabledWYSIWYGActionGroup" stepKey="disableWYSIWYG"/>
75-
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
76-
</after>
7783
</test>
7884
</tests>

app/code/Magento/Catalog/Test/Mftf/Test/AdminAddImageToWYSIWYGProductTest.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@
2020

2121
<before>
2222
<actionGroup ref="AdminLoginActionGroup" stepKey="login"/>
23+
<actionGroup ref="AdminMediaGalleryEnhancedEnableActionGroup" stepKey="enableOldMediaGallery">
24+
<argument name="enabled" value="0"/>
25+
</actionGroup>
2326
<actionGroup ref="EnabledWYSIWYGActionGroup" stepKey="enableWYSIWYG"/>
2427
<actionGroup ref="CliEnableTinyMCEActionGroup" stepKey="enableTinyMCE" />
2528
</before>
@@ -36,6 +39,9 @@
3639
<actionGroup ref="DeleteFolderActionGroup" stepKey="DeleteFolderFromMediaGallery">
3740
<argument name="Image" value="{{ImageFolder.name}}"/>
3841
</actionGroup>
42+
<actionGroup ref="AdminMediaGalleryEnhancedEnableActionGroup" stepKey="disableOldMediaGallery">
43+
<argument name="enabled" value="1"/>
44+
</actionGroup>
3945
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
4046
</after>
4147

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
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+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
10+
<test name="AdminCannotCreateSimpleProductWithEmptySKUTest">
11+
<annotations>
12+
<features value="Catalog"/>
13+
<stories value="Admin should not be able to create a product with SKU empty"/>
14+
<title value="Admin should not be able to create a product with SKU empty"/>
15+
<description value="Admin should not be able to create a product with SKU empty"/>
16+
<severity value="AVERAGE"/>
17+
<testCaseId value="AC-6020"/>
18+
<group value="product"/>
19+
<group value="pr_exclude"/>
20+
</annotations>
21+
<before>
22+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
23+
<actionGroup ref="NavigateToEditProductAttributeActionGroup" stepKey="goToEditPage">
24+
<argument name="ProductAttribute" value="sku"/>
25+
</actionGroup>
26+
<selectOption userInput="0" selector="#is_required" stepKey="selectOptionNo"/>
27+
<click stepKey="saveAttribute" selector="#save" />
28+
<waitForPageLoad stepKey="waitForSaveAttribute"/>
29+
</before>
30+
<after>
31+
<actionGroup ref="NavigateToEditProductAttributeActionGroup" stepKey="goToEditPage">
32+
<argument name="ProductAttribute" value="sku"/>
33+
</actionGroup>
34+
<selectOption userInput="1" selector="#is_required" stepKey="selectOptionYes"/>
35+
<click stepKey="saveAttribute" selector="#save" />
36+
<waitForPageLoad stepKey="waitForSaveAttribute" />
37+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
38+
</after>
39+
<actionGroup ref="AdminOpenNewProductFormPageActionGroup" stepKey="goToCreateProduct"/>
40+
<waitForPageLoad stepKey="waitForAdminOpenNewProductFormPageActionGroup" />
41+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="wait1"/>
42+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="fillName"/>
43+
<actionGroup ref="FillMainProductFormByStringActionGroup" stepKey="fillSKU">
44+
<argument name="productName" value="{{SimpleProduct.name}}"/>
45+
<argument name="productSku" value=""/>
46+
<argument name="productPrice" value="100"/>
47+
<argument name="productQuantity" value="{{SimpleProduct.quantity}}"/>
48+
<argument name="productStatus" value="{{SimpleProduct.status}}"/>
49+
<argument name="productWeight" value="{{SimpleProduct.weight}}"/>
50+
</actionGroup>
51+
<actionGroup ref="AdminProductFormSaveActionGroup" stepKey="clickSave"/>
52+
<waitForPageLoad stepKey="waitForAdminProductFormSaveActionGroup"/>
53+
<see selector="The &quot;sku&quot; attribute value is empty." stepKey="seeErrorMessage"/>
54+
</test>
55+
</tests>

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,7 @@ Category,Category
318318
"There is no MediaGalleryEntryConverter for given type","There is no MediaGalleryEntryConverter for given type"
319319
"Please enter a number 0 or greater in this field.","Please enter a number 0 or greater in this field."
320320
"The value of attribute ""%1"" must be set","The value of attribute ""%1"" must be set"
321+
"The "%1" attribute value is empty.","The "%1" attribute value is empty."
321322
"SKU length should be %1 characters maximum.","SKU length should be %1 characters maximum."
322323
"Please enter a valid number in this field.","Please enter a valid number in this field."
323324
"We found a duplicate website, tier price, customer group and quantity.","We found a duplicate website, tier price, customer group and quantity."

app/code/Magento/CatalogGraphQl/Model/Resolver/Product/ProductCategories.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public function getCategoryIdsByProduct(int $productId, int $storeId)
7070
['store_group' => $storeGroupTable],
7171
$connection->quoteInto(
7272
'store.group_id = store_group.group_id AND NOT EXISTS
73-
(SELECT 1 FROM store_group WHERE cat_index.category_id IN (store_group.root_category_id)
73+
(SELECT 1 FROM '.$storeGroupTable.' WHERE cat_index.category_id IN (store_group.root_category_id)
7474
and cat_index.product_id = ?)',
7575
$productId,
7676
\Zend_Db::INT_TYPE

app/code/Magento/CatalogInventory/Model/ResourceModel/StockStatusFilter.php

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,8 @@
1010
use Magento\CatalogInventory\Api\Data\StockStatusInterface;
1111
use Magento\CatalogInventory\Api\StockConfigurationInterface;
1212
use Magento\CatalogInventory\Model\Stock;
13-
use Magento\CatalogInventory\Model\StockStatusApplierInterface;
1413
use Magento\Framework\App\ResourceConnection;
1514
use Magento\Framework\DB\Select;
16-
use Magento\Framework\App\ObjectManager;
1715

1816
/**
1917
* Generic in-stock status filter
@@ -32,25 +30,16 @@ class StockStatusFilter implements StockStatusFilterInterface
3230
*/
3331
private $stockConfiguration;
3432

35-
/**
36-
* @var StockStatusApplierInterface
37-
*/
38-
private $stockStatusApplier;
39-
4033
/**
4134
* @param ResourceConnection $resource
4235
* @param StockConfigurationInterface $stockConfiguration
43-
* @param StockStatusApplierInterface|null $stockStatusApplier
4436
*/
4537
public function __construct(
4638
ResourceConnection $resource,
47-
StockConfigurationInterface $stockConfiguration,
48-
?StockStatusApplierInterface $stockStatusApplier = null
39+
StockConfigurationInterface $stockConfiguration
4940
) {
5041
$this->resource = $resource;
5142
$this->stockConfiguration = $stockConfiguration;
52-
$this->stockStatusApplier = $stockStatusApplier
53-
?? ObjectManager::getInstance()->get(StockStatusApplierInterface::class);
5443
}
5544

5645
/**
@@ -79,13 +68,7 @@ public function execute(
7968
implode(' AND ', $joinCondition),
8069
[]
8170
);
82-
83-
if ($this->stockStatusApplier->hasSearchResultApplier()) {
84-
$select->columns(["{$stockStatusTableAlias}.stock_status AS is_salable"]);
85-
} else {
86-
$select->where("{$stockStatusTableAlias}.stock_status = ?", StockStatusInterface::STATUS_IN_STOCK);
87-
}
88-
71+
$select->where("{$stockStatusTableAlias}.stock_status = ?", StockStatusInterface::STATUS_IN_STOCK);
8972
return $select;
9073
}
9174
}

0 commit comments

Comments
 (0)