Skip to content

Commit 52281e2

Browse files
authored
Merge branch '2.4-develop' into MCLOUD-10226
2 parents e73c0b5 + 13e54e1 commit 52281e2

File tree

401 files changed

+13606
-2072
lines changed

Some content is hidden

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

401 files changed

+13606
-2072
lines changed

app/code/Magento/Backend/Model/Auth/Session.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,16 @@ public function __construct(
114114
);
115115
}
116116

117+
/**
118+
* @inheritDoc
119+
*/
120+
public function _resetState(): void
121+
{
122+
parent::_resetState();
123+
$this->_isFirstAfterLogin = null;
124+
$this->acl = null;
125+
}
126+
117127
/**
118128
* Refresh ACL resources stored in session
119129
*

app/code/Magento/Backend/Model/Session/Quote.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,17 @@ public function __construct(
139139
}
140140
}
141141

142+
/**
143+
* @inheritDoc
144+
*/
145+
public function _resetState(): void
146+
{
147+
parent::_resetState();
148+
$this->_quote = null;
149+
$this->_store = null;
150+
$this->_order = null;
151+
}
152+
142153
/**
143154
* Retrieve quote model object
144155
*
@@ -154,7 +165,7 @@ public function getQuote()
154165
$this->_quote->setCustomerGroupId($customerGroupId);
155166
$this->_quote->setIsActive(false);
156167
$this->_quote->setStoreId($this->getStoreId());
157-
168+
158169
$this->quoteRepository->save($this->_quote);
159170
$this->setQuoteId($this->_quote->getId());
160171
$this->_quote = $this->quoteRepository->get($this->getQuoteId(), [$this->getStoreId()]);

app/code/Magento/Backend/Test/Mftf/Section/LocaleOptionsSection.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,8 @@
1818
<element name="defaultLocale" type="checkbox" selector="#general_locale_code_inherit"/>
1919
<element name="checkIfTabExpand" type="button" selector="#general_locale-head:not(.open)"/>
2020
<element name="timeZoneDropdown" type="select" selector="//select[@id='general_locale_timezone']"/>
21+
<element name="changeStoreConfigButton" type="button" selector="//button[@id='store-change-button']"/>
22+
<element name="changeStoreConfigToSpecificWebsite" type="select" selector="//a[contains(text(),'{{var}}')]" parameterized="true"/>
23+
<element name="changeWebsiteConfirmButton" type="button" selector="//button[@class='action-primary action-accept']/span"/>
2124
</section>
2225
</sections>

app/code/Magento/Backup/Controller/Adminhtml/Index/Download.php

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@
66
*/
77
namespace Magento\Backup\Controller\Adminhtml\Index;
88

9+
use Magento\Framework\App\Action\HttpGetActionInterface;
910
use Magento\Framework\App\Filesystem\DirectoryList;
1011

11-
class Download extends \Magento\Backup\Controller\Adminhtml\Index
12+
class Download extends \Magento\Backup\Controller\Adminhtml\Index implements HttpGetActionInterface
1213
{
1314
/**
1415
* @var \Magento\Framework\Controller\Result\RawFactory
@@ -66,17 +67,12 @@ public function execute()
6667

6768
$fileName = $this->_objectManager->get(\Magento\Backup\Helper\Data::class)->generateBackupDownloadName($backup);
6869

69-
$this->_fileFactory->create(
70+
return $this->_fileFactory->create(
7071
$fileName,
71-
null,
72+
['type' => 'filename', 'value' => $backup->getPath() . DIRECTORY_SEPARATOR . $backup->getFileName()],
7273
DirectoryList::VAR_DIR,
7374
'application/octet-stream',
7475
$backup->getSize()
7576
);
76-
77-
/** @var \Magento\Framework\Controller\Result\Raw $resultRaw */
78-
$resultRaw = $this->resultRawFactory->create();
79-
$resultRaw->setContents($backup->output());
80-
return $resultRaw;
8177
}
8278
}

app/code/Magento/Backup/Model/ResourceModel/Db.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ public function rollBackTransaction()
301301
*/
302302
public function runCommand($command)
303303
{
304-
$this->connection->query($command);
304+
$this->connection->multiQuery($command);
305305
return $this;
306306
}
307307
}

app/code/Magento/Backup/Test/Unit/Controller/Adminhtml/Index/DownloadTest.php

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ protected function setUp(): void
115115
->getMock();
116116
$this->backupModelMock = $this->getMockBuilder(Backup::class)
117117
->disableOriginalConstructor()
118-
->setMethods(['getTime', 'exists', 'getSize', 'output'])
118+
->setMethods(['getTime', 'exists', 'getSize', 'output', 'getPath', 'getFileName'])
119119
->getMock();
120120
$this->dataHelperMock = $this->getMockBuilder(Data::class)
121121
->disableOriginalConstructor()
@@ -169,8 +169,13 @@ public function testExecuteBackupFound()
169169
$type = 'db';
170170
$filename = 'filename';
171171
$size = 10;
172-
$output = 'test';
173-
172+
$path = 'testpath';
173+
$this->backupModelMock->expects($this->atLeastOnce())
174+
->method('getPath')
175+
->willReturn($path);
176+
$this->backupModelMock->expects($this->atLeastOnce())
177+
->method('getFileName')
178+
->willReturn($filename);
174179
$this->backupModelMock->expects($this->atLeastOnce())
175180
->method('getTime')
176181
->willReturn($time);
@@ -180,9 +185,6 @@ public function testExecuteBackupFound()
180185
$this->backupModelMock->expects($this->atLeastOnce())
181186
->method('getSize')
182187
->willReturn($size);
183-
$this->backupModelMock->expects($this->atLeastOnce())
184-
->method('output')
185-
->willReturn($output);
186188
$this->requestMock->expects($this->any())
187189
->method('getParam')
188190
->willReturnMap(
@@ -206,20 +208,14 @@ public function testExecuteBackupFound()
206208
$this->fileFactoryMock->expects($this->once())
207209
->method('create')->with(
208210
$filename,
209-
null,
211+
['type' => 'filename', 'value' => $path . '/' . $filename],
210212
DirectoryList::VAR_DIR,
211213
'application/octet-stream',
212214
$size
213215
)
214216
->willReturn($this->responseMock);
215-
$this->resultRawMock->expects($this->once())
216-
->method('setContents')
217-
->with($output);
218-
$this->resultRawFactoryMock->expects($this->once())
219-
->method('create')
220-
->willReturn($this->resultRawMock);
221217

222-
$this->assertSame($this->resultRawMock, $this->downloadController->execute());
218+
$this->assertSame($this->responseMock, $this->downloadController->execute());
223219
}
224220

225221
/**

app/code/Magento/Bundle/Model/ResourceModel/Selection/Collection.php

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,6 @@ public function __construct(
128128
$metadataPool,
129129
$tableMaintainer
130130
);
131-
132131
$this->stockItem = $stockItem
133132
?? ObjectManager::getInstance()->get(\Magento\CatalogInventory\Model\ResourceModel\Stock\Item::class);
134133
}
@@ -145,6 +144,17 @@ protected function _construct()
145144
$this->_selectionTable = $this->getTable('catalog_product_bundle_selection');
146145
}
147146

147+
/**
148+
* @inheritDoc
149+
*/
150+
public function _resetState(): void
151+
{
152+
parent::_resetState();
153+
$this->itemPrototype = null;
154+
$this->catalogRuleProcessor = null;
155+
$this->websiteScopePriceJoined = false;
156+
}
157+
148158
/**
149159
* Set store id for each collection item when collection was loaded.
150160
* phpcs:disable Generic.CodeAnalysis.UselessOverridingMethod
@@ -355,8 +365,6 @@ public function addPriceFilter($product, $searchMin, $useRegularPrice = false)
355365
* Get Catalog Rule Processor.
356366
*
357367
* @return \Magento\CatalogRule\Model\ResourceModel\Product\CollectionProcessor
358-
*
359-
* @deprecated 100.2.0
360368
*/
361369
private function getCatalogRuleProcessor()
362370
{

app/code/Magento/Bundle/Test/Mftf/Section/AdminProductFormBundleSection.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,5 +125,7 @@
125125
<element name="priceType" type="select" selector="[name='product[options][0][price_type]']" />
126126
<element name="priceTypeSelectPercent" type="select" selector="//*[@name='product[options][0][price_type]']/option[2]" />
127127
<element name="weightFieldLabel" type="input" selector="//div[@data-index='weight']/div/label/span"/>
128+
<!--Errors-->
129+
<element name="fieldError" type="text" selector=".admin__field-error[data-bind='attr: {for: {{field}}}, text: error']" parameterized="true"/>
128130
</section>
129131
</sections>
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
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+
9+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
11+
<test name="AdminAddDecimalDefaultToBundleItemsTest">
12+
<annotations>
13+
<features value="Bundle"/>
14+
<stories value="Create/Edit bundle product in Admin"/>
15+
<title value="Admin should be able to set decimal default to bundle item when item allows it"/>
16+
<description value="Admin should be able to set decimal default value to new bundle option"/>
17+
<severity value="AVERAGE"/>
18+
<testCaseId value="AC-8646"/>
19+
<useCaseId value="ACP2E-1799"/>
20+
<group value="Bundle"/>
21+
</annotations>
22+
<before>
23+
<createData entity="_defaultCategory" stepKey="createPreReqCategory"/>
24+
<createData entity="SimpleProduct2" stepKey="simpleProduct1"/>
25+
<createData entity="SimpleProduct2" stepKey="simpleProduct2"/>
26+
<actionGroup stepKey="loginToAdminPanel" ref="AdminLoginActionGroup"/>
27+
</before>
28+
<after>
29+
<deleteData createDataKey="createPreReqCategory" stepKey="deletePreReqCategory"/>
30+
<deleteData createDataKey="simpleProduct1" stepKey="deleteSimpleProduct1"/>
31+
<deleteData createDataKey="simpleProduct2" stepKey="deleteSimpleProduct2"/>
32+
<actionGroup ref="AdminOpenProductIndexPageActionGroup" stepKey="navigateToProductIndex"/>
33+
<actionGroup ref="ResetAdminDataGridToDefaultViewActionGroup" stepKey="clearFilters"/>
34+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
35+
</after>
36+
37+
<!-- Open simpleProduct1 in Admin -->
38+
<actionGroup ref="SearchForProductOnBackendActionGroup" stepKey="filterSimpleProduct1">
39+
<argument name="product" value="SimpleProduct2"/>
40+
</actionGroup>
41+
<click selector="{{AdminProductGridSection.productGridNameProduct('$$simpleProduct1.name$$')}}" stepKey="clickOpenProductForEdit"/>
42+
<waitForPageLoad time="30" stepKey="waitForProductEditOpen"/>
43+
<!-- Open *Advanced Inventory* pop-up (Click on *Advanced Inventory* link). Set *Qty Uses Decimals* to *Yes*. Click on button *Done* -->
44+
<actionGroup ref="AdminClickOnAdvancedInventoryLinkActionGroup" stepKey="clickOnAdvancedInventoryLink"/>
45+
<actionGroup ref="AdminSetQtyUsesDecimalsConfigActionGroup" stepKey="setQtyUsesDecimalsConfig">
46+
<argument name="value" value="Yes"/>
47+
</actionGroup>
48+
<actionGroup ref="AdminSubmitAdvancedInventoryFormActionGroup" stepKey="clickOnDoneButton"/>
49+
<actionGroup ref="AdminProductFormSaveActionGroup" stepKey="clickOnSaveButton"/>
50+
51+
<!-- Create new Bundle product -->
52+
<actionGroup ref="AdminOpenCreateBundleProductPageActionGroup" stepKey="goToBundleProductCreationPage"/>
53+
<actionGroup ref="AdminClickAddOptionOnBundleProductEditPageActionGroup" stepKey="clickAddOption1"/>
54+
<actionGroup ref="AdminFillBundleOptionTitleActionGroup" stepKey="fillOptionTitle">
55+
<argument name="optionTitle" value="{{BundleProduct.optionTitle1}}"/>
56+
</actionGroup>
57+
<actionGroup ref="AdminFillBundleOptionTypeActionGroup" stepKey="selectInputType"/>
58+
59+
<actionGroup ref="AdminClickAddProductToOptionByOptionIndexActionGroup" stepKey="clickAddProductsToOption"/>
60+
<actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="filterBundleProductOptions">
61+
<argument name="product" value="$$simpleProduct1$$"/>
62+
</actionGroup>
63+
<actionGroup ref="AdminCheckFirstCheckboxInAddProductsToOptionPanelGridActionGroup" stepKey="selectFirstGridRow"/>
64+
<actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="filterBundleProductOptions2">
65+
<argument name="product" value="$$simpleProduct2$$"/>
66+
</actionGroup>
67+
<actionGroup ref="AdminCheckFirstCheckboxInAddProductsToOptionPanelGridActionGroup" stepKey="selectFirstGridRow2"/>
68+
<actionGroup ref="AdminClickAddSelectedProductsOnAddProductsToOptionPanelActionGroup" stepKey="clickAddSelectedBundleProducts"/>
69+
70+
<grabValueFrom selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity('0', '0')}}" stepKey="grabbedFirstBundleOptionQuantity"/>
71+
<assertEquals stepKey="assertFirstBundleOptionDefaultQuantity">
72+
<expectedResult type="string">1</expectedResult>
73+
<actualResult type="string">$grabbedFirstBundleOptionQuantity</actualResult>
74+
</assertEquals>
75+
<grabValueFrom selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity('0', '1')}}" stepKey="grabbedSecondBundleOptionQuantity"/>
76+
<assertEquals stepKey="assertSecondBundleOptionDefaultQuantity">
77+
<expectedResult type="string">1</expectedResult>
78+
<actualResult type="string">$grabbedSecondBundleOptionQuantity</actualResult>
79+
</assertEquals>
80+
81+
<!-- Fill first selection with decimal value -->
82+
<actionGroup ref="AdminFillBundleItemQtyActionGroup" stepKey="fillProduct1DefaultQty">
83+
<argument name="optionIndex" value="0"/>
84+
<argument name="productIndex" value="0"/>
85+
<argument name="qty" value="2.56"/>
86+
</actionGroup>
87+
88+
<!-- Check there is no error message for the slection with allowed decimal value -->
89+
<dontSee selector="{{AdminProductFormBundleSection.fieldError('uid')}}" userInput="Please enter a valid number in this field." stepKey="doNotSeeErrorMessageForProduct1"/>
90+
91+
<!-- Fill second selection with decimal value -->
92+
<actionGroup ref="AdminFillBundleItemQtyActionGroup" stepKey="fillProduct2DefaultQty">
93+
<argument name="optionIndex" value="0"/>
94+
<argument name="productIndex" value="1"/>
95+
<argument name="qty" value="2.56"/>
96+
</actionGroup>
97+
98+
<!-- Check there is an error message for the slection with not allowed decimal value -->
99+
<see selector="{{AdminProductFormBundleSection.fieldError('uid')}}" userInput="Please enter a valid number in this field." stepKey="seeErrorMessageForProduct2"/>
100+
101+
</test>
102+
</tests>

app/code/Magento/Bundle/Test/Unit/Ui/DataProvider/Product/BundleDataProviderTest.php

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,13 @@
1414
use Magento\Framework\App\RequestInterface;
1515
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
1616
use Magento\Store\Model\Store;
17+
use Magento\Ui\DataProvider\Modifier\PoolInterface;
1718
use PHPUnit\Framework\MockObject\MockObject;
1819
use PHPUnit\Framework\TestCase;
1920

2021
class BundleDataProviderTest extends TestCase
2122
{
22-
const ALLOWED_TYPE = 'simple';
23+
private const ALLOWED_TYPE = 'simple';
2324

2425
/**
2526
* @var ObjectManager
@@ -46,13 +47,21 @@ class BundleDataProviderTest extends TestCase
4647
*/
4748
protected $dataHelperMock;
4849

50+
/**
51+
* @var PoolInterface|MockObject
52+
*/
53+
private $modifierPool;
54+
4955
/**
5056
* @return void
5157
*/
5258
protected function setUp(): void
5359
{
5460
$this->objectManager = new ObjectManager($this);
5561

62+
$this->modifierPool = $this->getMockBuilder(PoolInterface::class)
63+
->getMockForAbstractClass();
64+
5665
$this->requestMock = $this->getMockBuilder(RequestInterface::class)
5766
->getMockForAbstractClass();
5867
$this->collectionMock = $this->getMockBuilder(Collection::class)
@@ -97,6 +106,7 @@ protected function getModel()
97106
'addFilterStrategies' => [],
98107
'meta' => [],
99108
'data' => [],
109+
'modifiersPool' => $this->modifierPool,
100110
]);
101111
}
102112

@@ -128,6 +138,9 @@ public function testGetData()
128138
$this->collectionMock->expects($this->once())
129139
->method('getSize')
130140
->willReturn(count($items));
141+
$this->modifierPool->expects($this->once())
142+
->method('getModifiersInstances')
143+
->willReturn([]);
131144

132145
$this->assertEquals($expectedData, $this->getModel()->getData());
133146
}

0 commit comments

Comments
 (0)