Skip to content

Commit 69c558d

Browse files
authored
Merge branch '2.4-develop' into B2B-2471
2 parents 6ef2e01 + eac615e commit 69c558d

File tree

26 files changed

+478
-550
lines changed

26 files changed

+478
-550
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/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
}

app/code/Magento/CatalogInventory/Model/StockStatusApplier.php

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

1010
/**
1111
* Search Result Applier getters and setters
12+
*
13+
* @deprecated - as the implementation has been reverted during the fix of ACP2E-748
14+
* @see \Magento\InventoryCatalog\Plugin\Catalog\Model\ResourceModel\Product\CollectionPlugin
1215
*/
1316
class StockStatusApplier implements StockStatusApplierInterface
1417
{
@@ -23,6 +26,8 @@ class StockStatusApplier implements StockStatusApplierInterface
2326
* Set flag, if the request is originated from SearchResultApplier
2427
*
2528
* @param bool $status
29+
* @deprecated
30+
* @see \Magento\InventoryCatalog\Plugin\Catalog\Model\ResourceModel\Product\CollectionPlugin::beforeSetOrder
2631
*/
2732
public function setSearchResultApplier(bool $status): void
2833
{
@@ -33,6 +38,8 @@ public function setSearchResultApplier(bool $status): void
3338
* Get flag, if the request is originated from SearchResultApplier
3439
*
3540
* @return bool
41+
* @deprecated
42+
* @see \Magento\InventoryCatalog\Plugin\Catalog\Model\ResourceModel\Product\CollectionPlugin::beforeSetOrder
3643
*/
3744
public function hasSearchResultApplier() : bool
3845
{

app/code/Magento/CatalogInventory/Model/StockStatusApplierInterface.php

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

1010
/**
1111
* Search Result Applier interface.
12+
*
13+
* @deprecated - as the implementation has been reverted during the fix of ACP2E-748
14+
* @see \Magento\InventoryCatalog\Plugin\Catalog\Model\ResourceModel\Product\CollectionPlugin
1215
*/
1316
interface StockStatusApplierInterface
1417
{
@@ -17,13 +20,17 @@ interface StockStatusApplierInterface
1720
* Set flag, if the request is originated from SearchResultApplier
1821
*
1922
* @param bool $status
23+
* @deprecated
24+
* @see \Magento\InventoryCatalog\Plugin\Catalog\Model\ResourceModel\Product\CollectionPlugin::beforeSetOrder
2025
*/
2126
public function setSearchResultApplier(bool $status): void;
2227

2328
/**
2429
* Get flag, if the request is originated from SearchResultApplier
2530
*
2631
* @return bool
32+
* @deprecated
33+
* @see \Magento\InventoryCatalog\Plugin\Catalog\Model\ResourceModel\Product\CollectionPlugin::beforeSetOrder
2734
*/
2835
public function hasSearchResultApplier() : bool;
2936
}
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
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="OnePageCheckoutForErrorTest">
11+
<annotations>
12+
<features value="Checkout"/>
13+
<stories value="Checkout Free Shipping Recalculation after Coupon Code Added For Error Message Check"/>
14+
<title value="Checkout Free Shipping Recalculation after Coupon Code Added For Error Message Check"/>
15+
<description value="User should be able to do checkout free shipping recalculation after adding coupon code"/>
16+
<severity value="BLOCKER"/>
17+
<testCaseId value="MC-28548"/>
18+
<useCaseId value="MAGETWO-96431"/>
19+
<group value="Checkout"/>
20+
</annotations>
21+
22+
<before>
23+
<createData entity="Simple_US_Customer" stepKey="createCustomer">
24+
<field key="group_id">1</field>
25+
</createData>
26+
<createData entity="_defaultCategory" stepKey="defaultCategory"/>
27+
<createData entity="_defaultProduct" stepKey="simpleProduct">
28+
<field key="price">90</field>
29+
<requiredEntity createDataKey="defaultCategory"/>
30+
</createData>
31+
<!--It is default for FlatRate-->
32+
<createData entity="FlatRateShippingMethodConfig" stepKey="enableFlatRate"/>
33+
<createData entity="FreeShippingMethodsSettingConfig" stepKey="freeShippingMethodsSettingConfig"/>
34+
<createData entity="MinimumOrderAmount90" stepKey="minimumOrderAmount90"/>
35+
<comment userInput="Adding the comment to replace CliCacheFlushActionGroup action group ('cache:flush' command) for preserving Backward Compatibility" stepKey="flushCache"/>
36+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
37+
<actionGroup ref="AdminCartPriceRuleDeleteAllActionGroup" stepKey="deleteAllCartPriceRules"/>
38+
<actionGroup ref="AdminCreateCartPriceRuleWithCouponCodeActionGroup" stepKey="createCartPriceRule">
39+
<argument name="ruleName" value="CatPriceRule"/>
40+
<argument name="couponCode" value="CatPriceRule.coupon_code"/>
41+
</actionGroup>
42+
<actionGroup ref="LoginToStorefrontActionGroup" stepKey="loginToStoreFront">
43+
<argument name="Customer" value="$createCustomer$"/>
44+
</actionGroup>
45+
<actionGroup ref="StorefrontOpenProductPageActionGroup" stepKey="openProductPage">
46+
<argument name="productUrl" value="$simpleProduct.custom_attributes[url_key]$"/>
47+
</actionGroup>
48+
</before>
49+
50+
<after>
51+
<deleteData createDataKey="simpleProduct" stepKey="deleteProduct"/>
52+
<deleteData createDataKey="defaultCategory" stepKey="deleteCategory"/>
53+
<createData entity="DefaultShippingMethodsConfig" stepKey="defaultShippingMethodsConfig"/>
54+
<createData entity="DefaultMinimumOrderAmount" stepKey="defaultMinimumOrderAmount"/>
55+
<deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/>
56+
<comment userInput="Adding the comment to replace CliCacheFlushActionGroup action group ('cache:flush' command) for preserving Backward Compatibility" stepKey="flushCache"/>
57+
<actionGroup ref="AdminCartPriceRuleDeleteAllActionGroup" stepKey="deleteAllCartPriceRules"/>
58+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
59+
</after>
60+
61+
<actionGroup ref="AddProductToStorefrontActionGroup" stepKey="addToCartProduct">
62+
<argument name="product" value="$simpleProduct$"/>
63+
</actionGroup>
64+
<actionGroup ref="GoToCheckoutFromMinicartActionGroup" stepKey="goToCheckoutFromMinicart1"/>
65+
66+
67+
<waitForPageLoad stepKey="waitForShippingMethods"/>
68+
<click selector="{{CheckoutShippingMethodsSection.shippingMethodRowByName('Free')}}" stepKey="chooseFreeShipping"/>
69+
<actionGroup ref="StorefrontCheckoutClickNextOnShippingStepActionGroup" stepKey="clickNextAfterFreeShippingMethodSelection"/>
70+
<waitForPageLoad stepKey="waitForReviewAndPayments"/>
71+
<actionGroup ref="StorefrontApplyDiscountCodeActionGroup" stepKey="applyCouponCode">
72+
<argument name="discountCode" value="{{CatPriceRule.coupon_code}}"/>
73+
</actionGroup>
74+
<!-- Assert order cannot be placed and error message will shown. -->
75+
<actionGroup ref="AssertStorefrontOrderIsNotPlacedActionGroup" stepKey="seeShippingMethodError">
76+
<argument name="error" value="The shipping method is missing. Select the shipping method and try again."/>
77+
</actionGroup>
78+
</test>
79+
</tests>

0 commit comments

Comments
 (0)