Skip to content

Commit e762b52

Browse files
committed
Merge branch '2.4-develop' into Refactoring-AdminConfigurableProductCreateTest
2 parents eb772c1 + c998238 commit e762b52

File tree

26 files changed

+783
-73
lines changed

26 files changed

+783
-73
lines changed

app/code/Magento/Bundle/Test/Mftf/Test/StorefrontCustomerSearchBundleProductsByKeywordsTest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
</createData>
4242

4343
<actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex">
44-
<argument name="indices" value="cataloginventory_stock catalog_product_price"/>
44+
<argument name="indices" value=""/>
4545
</actionGroup>
4646
</before>
4747
<after>

app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminClickOnAdvancedInventoryLinkActionGroup.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,7 @@
1717

1818
<click selector="{{AdminProductFormSection.advancedInventoryLink}}" stepKey="clickOnAdvancedInventoryLink"/>
1919
<waitForPageLoad stepKey="waitForAdvancedInventoryPageToLoad"/>
20+
<!-- Wait for close button appeared. That means animation finished and modal window is fully visible -->
21+
<waitForElementVisible selector="{{AdminProductFormAdvancedInventorySection.advancedInventoryCloseButton}}" stepKey="waitForCloseButtonAppeared"/>
2022
</actionGroup>
2123
</actionGroups>

app/code/Magento/Catalog/Test/Mftf/Data/ProductData.xml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1392,9 +1392,34 @@
13921392
<entity name="SimpleProductUpdatePrice16" type="product2">
13931393
<data key="price">16.00</data>
13941394
</entity>
1395+
<entity name="SimpleProductUpdatePrice90" type="product2">
1396+
<data key="price">90.00</data>
1397+
</entity>
1398+
<entity name="SimpleProductUpdatePrice95" type="product2">
1399+
<data key="price">95.00</data>
1400+
</entity>
1401+
<entity name="SimpleProductUpdatePrice80" type="product2">
1402+
<data key="price">80.00</data>
1403+
</entity>
13951404
<entity name="ProductWithTwoTextFieldOptions" type="product">
13961405
<var key="sku" entityType="product" entityKey="sku" />
13971406
<requiredEntity type="product_option">ProductOptionField</requiredEntity>
13981407
<requiredEntity type="product_option">ProductOptionField2</requiredEntity>
13991408
</entity>
1409+
<entity name="SimpleProductWithCustomSku24MB01" type="product" extends="SimpleProduct2">
1410+
<data key="name" unique="suffix">ProductWithSku24MB01-</data>
1411+
<data key="sku" unique="suffix">24 MB01</data>
1412+
</entity>
1413+
<entity name="SimpleProductWithCustomSku24MB02" type="product" extends="SimpleProduct2">
1414+
<data key="name" unique="suffix">ProductWithSku24MB02-</data>
1415+
<data key="sku" unique="suffix">24 MB02 </data>
1416+
</entity>
1417+
<entity name="SimpleProductWithCustomSku24MB04" type="product" extends="SimpleProduct2">
1418+
<data key="name" unique="suffix">ProductWithSku24MB04-</data>
1419+
<data key="sku" unique="suffix">24 MB04 </data>
1420+
</entity>
1421+
<entity name="SimpleProductWithCustomSku24MB06" type="product" extends="SimpleProduct2">
1422+
<data key="name" unique="suffix">ProductWithSku24MB06-</data>
1423+
<data key="sku" unique="suffix">24 MB06 </data>
1424+
</entity>
14001425
</entities>

app/code/Magento/CatalogInventory/Test/Mftf/ActionGroup/AdminCatalogInventoryChangeManageStockActionGroup.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
<argument name="manageStock" type="string" defaultValue="Yes"/>
1717
</arguments>
1818
<conditionalClick selector="{{AdminProductFormSection.advancedInventoryLink}}" dependentSelector="{{AdminProductFormAdvancedInventorySection.advancedInventoryModal}}" visible="false" stepKey="openAdvancedInventoryWindow"/>
19+
<!-- Wait for close button appeared. That means animation finished and modal window is fully visible -->
20+
<waitForElementVisible selector="{{AdminProductFormAdvancedInventorySection.advancedInventoryCloseButton}}" stepKey="waitForCloseButtonAppeared"/>
1921
<waitForElementVisible selector="{{AdminProductFormAdvancedInventorySection.useConfigSettings}}" stepKey="waitForAdvancedInventoryModalWindowOpen"/>
2022
<uncheckOption selector="{{AdminProductFormAdvancedInventorySection.useConfigSettings}}" stepKey="uncheckManageStockConfigSetting"/>
2123
<selectOption selector="{{AdminProductFormAdvancedInventorySection.manageStock}}" userInput="{{manageStock}}" stepKey="changeManageStock"/>

app/code/Magento/CatalogInventory/Test/Mftf/ActionGroup/AdminProductSetMaxQtyAllowedInShoppingCartActionGroup.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@
1313
<argument name="qty" type="string"/>
1414
</arguments>
1515
<conditionalClick selector="{{AdminProductFormSection.advancedInventoryLink}}" dependentSelector="{{AdminProductFormAdvancedInventorySection.advancedInventoryModal}}" visible="false" stepKey="clickOnAdvancedInventoryLinkIfNeeded"/>
16+
<!-- Wait for close button appeared. That means animation finished and modal window is fully visible -->
17+
<waitForElementVisible selector="{{AdminProductFormAdvancedInventorySection.advancedInventoryCloseButton}}" stepKey="waitForCloseButtonAppeared"/>
1618
<waitForElementVisible selector="{{AdminProductFormAdvancedInventorySection.maxiQtyConfigSetting}}" stepKey="waitForAdvancedInventoryModalWindowOpen"/>
1719
<uncheckOption selector="{{AdminProductFormAdvancedInventorySection.maxiQtyConfigSetting}}" stepKey="uncheckMaxQtyCheckBox"/>
1820
<fillField selector="{{AdminProductFormAdvancedInventorySection.maxiQtyAllowedInCart}}" userInput="{{qty}}" stepKey="fillMaxAllowedQty"/>
1921
<click selector="{{AdminSlideOutDialogSection.doneButton}}" stepKey="clickDone"/>
2022
</actionGroup>
21-
22-
2323
</actionGroups>

app/code/Magento/Checkout/Controller/Cart/UpdateItemOptions.php

Lines changed: 27 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,29 @@
11
<?php
22
/**
3-
*
43
* Copyright © Magento, Inc. All rights reserved.
54
* See COPYING.txt for license details.
65
*/
76

87
namespace Magento\Checkout\Controller\Cart;
98

9+
use Magento\Checkout\Controller\Cart;
10+
use Magento\Checkout\Helper\Cart as CartHelper;
1011
use Magento\Framework\App\Action\HttpPostActionInterface as HttpPostActionInterface;
12+
use Magento\Framework\Controller\Result\Redirect;
13+
use Magento\Framework\DataObject;
14+
use Magento\Framework\Exception\LocalizedException;
15+
use Magento\Framework\Locale\ResolverInterface;
16+
use Psr\Log\LoggerInterface;
1117

12-
class UpdateItemOptions extends \Magento\Checkout\Controller\Cart implements HttpPostActionInterface
18+
/**
19+
* Process updating product options in a cart item.
20+
*/
21+
class UpdateItemOptions extends Cart implements HttpPostActionInterface
1322
{
1423
/**
15-
* Update product configuration for a cart item
24+
* Update product configuration for a cart item.
1625
*
17-
* @return \Magento\Framework\Controller\Result\Redirect
26+
* @return Redirect
1827
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
1928
* @SuppressWarnings(PHPMD.NPathComplexity)
2029
*/
@@ -28,27 +37,27 @@ public function execute()
2837
}
2938
try {
3039
if (isset($params['qty'])) {
31-
$filter = new \Zend_Filter_LocalizedToNormalized(
32-
['locale' => $this->_objectManager->get(
33-
\Magento\Framework\Locale\ResolverInterface::class
34-
)->getLocale()]
40+
$inputFilter = new \Zend_Filter_LocalizedToNormalized(
41+
[
42+
'locale' => $this->_objectManager->get(ResolverInterface::class)->getLocale(),
43+
]
3544
);
36-
$params['qty'] = $filter->filter($params['qty']);
45+
$params['qty'] = $inputFilter->filter($params['qty']);
3746
}
3847

3948
$quoteItem = $this->cart->getQuote()->getItemById($id);
4049
if (!$quoteItem) {
41-
throw new \Magento\Framework\Exception\LocalizedException(
50+
throw new LocalizedException(
4251
__("The quote item isn't found. Verify the item and try again.")
4352
);
4453
}
4554

46-
$item = $this->cart->updateItem($id, new \Magento\Framework\DataObject($params));
55+
$item = $this->cart->updateItem($id, new DataObject($params));
4756
if (is_string($item)) {
48-
throw new \Magento\Framework\Exception\LocalizedException(__($item));
57+
throw new LocalizedException(__($item));
4958
}
5059
if ($item->getHasError()) {
51-
throw new \Magento\Framework\Exception\LocalizedException(__($item->getMessage()));
60+
throw new LocalizedException(__($item->getMessage()));
5261
}
5362

5463
$related = $this->getRequest()->getParam('related_product');
@@ -73,7 +82,7 @@ public function execute()
7382
}
7483
return $this->_goBack($this->_url->getUrl('checkout/cart'));
7584
}
76-
} catch (\Magento\Framework\Exception\LocalizedException $e) {
85+
} catch (LocalizedException $e) {
7786
if ($this->_checkoutSession->getUseNotice(true)) {
7887
$this->messageManager->addNoticeMessage($e->getMessage());
7988
} else {
@@ -87,14 +96,15 @@ public function execute()
8796
if ($url) {
8897
return $this->resultRedirectFactory->create()->setUrl($url);
8998
} else {
90-
$cartUrl = $this->_objectManager->get(\Magento\Checkout\Helper\Cart::class)->getCartUrl();
91-
return $this->resultRedirectFactory->create()->setUrl($this->_redirect->getRedirectUrl($cartUrl));
99+
$cartUrl = $this->_objectManager->get(CartHelper::class)->getCartUrl();
100+
return $this->resultRedirectFactory->create()->setUrl($cartUrl);
92101
}
93102
} catch (\Exception $e) {
94103
$this->messageManager->addExceptionMessage($e, __('We can\'t update the item right now.'));
95-
$this->_objectManager->get(\Psr\Log\LoggerInterface::class)->critical($e);
104+
$this->_objectManager->get(LoggerInterface::class)->critical($e);
96105
return $this->_goBack();
97106
}
107+
98108
return $this->resultRedirectFactory->create()->setPath('*/*');
99109
}
100110
}

app/code/Magento/Cms/Controller/Adminhtml/Page/Save.php

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,28 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
declare(strict_types=1);
7+
68
namespace Magento\Cms\Controller\Adminhtml\Page;
79

8-
use Magento\Framework\App\Action\HttpPostActionInterface;
910
use Magento\Backend\App\Action;
11+
use Magento\Backend\Model\View\Result\Redirect;
12+
use Magento\Cms\Api\Data\PageInterface;
13+
use Magento\Cms\Api\PageRepositoryInterface;
1014
use Magento\Cms\Model\Page;
15+
use Magento\Cms\Model\PageFactory;
16+
use Magento\Framework\App\Action\HttpPostActionInterface;
1117
use Magento\Framework\App\ObjectManager;
1218
use Magento\Framework\App\Request\DataPersistorInterface;
19+
use Magento\Framework\Controller\ResultInterface;
1320
use Magento\Framework\Exception\LocalizedException;
1421

1522
/**
1623
* Save CMS page action.
1724
*
1825
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
1926
*/
20-
class Save extends \Magento\Backend\App\Action implements HttpPostActionInterface
27+
class Save extends Action implements HttpPostActionInterface
2128
{
2229
/**
2330
* Authorization level of a basic admin session
@@ -37,47 +44,46 @@ class Save extends \Magento\Backend\App\Action implements HttpPostActionInterfac
3744
protected $dataPersistor;
3845

3946
/**
40-
* @var \Magento\Cms\Model\PageFactory
47+
* @var PageFactory
4148
*/
4249
private $pageFactory;
4350

4451
/**
45-
* @var \Magento\Cms\Api\PageRepositoryInterface
52+
* @var PageRepositoryInterface
4653
*/
4754
private $pageRepository;
4855

4956
/**
5057
* @param Action\Context $context
5158
* @param PostDataProcessor $dataProcessor
5259
* @param DataPersistorInterface $dataPersistor
53-
* @param \Magento\Cms\Model\PageFactory|null $pageFactory
54-
* @param \Magento\Cms\Api\PageRepositoryInterface|null $pageRepository
60+
* @param PageFactory|null $pageFactory
61+
* @param PageRepositoryInterface|null $pageRepository
5562
*/
5663
public function __construct(
5764
Action\Context $context,
5865
PostDataProcessor $dataProcessor,
5966
DataPersistorInterface $dataPersistor,
60-
\Magento\Cms\Model\PageFactory $pageFactory = null,
61-
\Magento\Cms\Api\PageRepositoryInterface $pageRepository = null
67+
PageFactory $pageFactory = null,
68+
PageRepositoryInterface $pageRepository = null
6269
) {
6370
$this->dataProcessor = $dataProcessor;
6471
$this->dataPersistor = $dataPersistor;
65-
$this->pageFactory = $pageFactory ?: ObjectManager::getInstance()->get(\Magento\Cms\Model\PageFactory::class);
66-
$this->pageRepository = $pageRepository
67-
?: ObjectManager::getInstance()->get(\Magento\Cms\Api\PageRepositoryInterface::class);
72+
$this->pageFactory = $pageFactory ?: ObjectManager::getInstance()->get(PageFactory::class);
73+
$this->pageRepository = $pageRepository ?: ObjectManager::getInstance()->get(PageRepositoryInterface::class);
6874
parent::__construct($context);
6975
}
7076

7177
/**
7278
* Save action
7379
*
7480
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
75-
* @return \Magento\Framework\Controller\ResultInterface
81+
* @return ResultInterface
7682
*/
7783
public function execute()
7884
{
7985
$data = $this->getRequest()->getPostValue();
80-
/** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */
86+
/** @var Redirect $resultRedirect */
8187
$resultRedirect = $this->resultRedirectFactory->create();
8288
if ($data) {
8389
$data = $this->dataProcessor->filter($data);
@@ -88,7 +94,7 @@ public function execute()
8894
$data['page_id'] = null;
8995
}
9096

91-
/** @var \Magento\Cms\Model\Page $model */
97+
/** @var Page $model */
9298
$model = $this->pageFactory->create();
9399

94100
$id = $this->getRequest()->getParam('page_id');
@@ -117,7 +123,7 @@ public function execute()
117123
} catch (LocalizedException $e) {
118124
$this->messageManager->addExceptionMessage($e->getPrevious() ?: $e);
119125
} catch (\Throwable $e) {
120-
$this->messageManager->addExceptionMessage($e, __('Something went wrong while saving the page.'));
126+
$this->messageManager->addErrorMessage(__('Something went wrong while saving the page.'));
121127
}
122128

123129
$this->dataPersistor->set('cms_page', $data);
@@ -129,10 +135,10 @@ public function execute()
129135
/**
130136
* Process result redirect
131137
*
132-
* @param \Magento\Cms\Api\Data\PageInterface $model
133-
* @param \Magento\Backend\Model\View\Result\Redirect $resultRedirect
138+
* @param PageInterface $model
139+
* @param Redirect $resultRedirect
134140
* @param array $data
135-
* @return \Magento\Backend\Model\View\Result\Redirect
141+
* @return Redirect
136142
* @throws LocalizedException
137143
*/
138144
private function processResultRedirect($model, $resultRedirect, $data)
@@ -149,7 +155,7 @@ private function processResultRedirect($model, $resultRedirect, $data)
149155
'*/*/edit',
150156
[
151157
'page_id' => $newPage->getId(),
152-
'_current' => true
158+
'_current' => true,
153159
]
154160
);
155161
}

0 commit comments

Comments
 (0)