Skip to content

Commit 76c1d9b

Browse files
committed
Merge branch '2.3-develop' into reece-pr
2 parents 84eaab4 + 7fc1ef6 commit 76c1d9b

File tree

62 files changed

+734
-126
lines changed

Some content is hidden

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

62 files changed

+734
-126
lines changed

app/code/Magento/Backend/Model/Config/SessionLifetime/BackendModel.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,17 @@
1616
*/
1717
class BackendModel extends Value
1818
{
19-
/** Maximum dmin session lifetime; 1 year*/
19+
/** Maximum admin session lifetime; 1 year*/
2020
const MAX_LIFETIME = 31536000;
2121

2222
/** Minimum admin session lifetime */
2323
const MIN_LIFETIME = 60;
2424

2525
/**
26+
* Processing object before save data
27+
*
2628
* @since 100.1.0
29+
* @throws LocalizedException
2730
*/
2831
public function beforeSave()
2932
{
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
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+
namespace Magento\Backend\Test\Unit\Service\V1;
9+
10+
use Magento\Backend\Service\V1\ModuleService;
11+
use Magento\Framework\Module\ModuleListInterface;
12+
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
13+
14+
/**
15+
* Module List Service Test
16+
*
17+
* Covers \Magento\Sales\Model\ValidatorResultMerger
18+
*/
19+
class ModuleServiceTest extends \PHPUnit\Framework\TestCase
20+
{
21+
/**
22+
* Testable Object
23+
*
24+
* @var ModuleService
25+
*/
26+
private $moduleService;
27+
28+
/**
29+
* @var ModuleListInterface|\PHPUnit_Framework_MockObject_MockObject
30+
*/
31+
private $moduleListMock;
32+
33+
/**
34+
* Object Manager
35+
*
36+
* @var ObjectManager
37+
*/
38+
private $objectManager;
39+
40+
/**
41+
* Set Up
42+
*
43+
* @return void
44+
*/
45+
protected function setUp()
46+
{
47+
$this->moduleListMock = $this->createMock(ModuleListInterface::class);
48+
$this->objectManager = new ObjectManager($this);
49+
$this->moduleService = $this->objectManager->getObject(
50+
ModuleService::class,
51+
[
52+
'moduleList' => $this->moduleListMock,
53+
]
54+
);
55+
}
56+
57+
/**
58+
* Test getModules method
59+
*
60+
* @return void
61+
*/
62+
public function testGetModules()
63+
{
64+
$moduleNames = ['Magento_Backend', 'Magento_Catalog', 'Magento_Customer'];
65+
$this->moduleListMock->expects($this->once())->method('getNames')->willReturn($moduleNames);
66+
67+
$expected = $moduleNames;
68+
$actual = $this->moduleService->getModules();
69+
$this->assertEquals($expected, $actual);
70+
}
71+
}

app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Set/Main/Formgroup.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111

1212
use Magento\Backend\Block\Widget\Form;
1313

14+
/**
15+
* Form group for attribute set
16+
*/
1417
class Formgroup extends \Magento\Backend\Block\Widget\Form\Generic
1518
{
1619
/**
@@ -37,6 +40,8 @@ public function __construct(
3740
}
3841

3942
/**
43+
* Prepare form elements
44+
*
4045
* @return void
4146
*/
4247
protected function _prepareForm()
@@ -77,13 +82,15 @@ protected function _prepareForm()
7782
}
7883

7984
/**
85+
* Returns set id
86+
*
8087
* @return int
8188
*/
8289
protected function _getSetId()
8390
{
84-
return intval(
91+
return (int)(
8592
$this->getRequest()->getParam('id')
86-
) > 0 ? intval(
93+
) > 0 ? (int)(
8794
$this->getRequest()->getParam('id')
8895
) : $this->_typeFactory->create()->load(
8996
$this->_coreRegistry->registry('entityType')

app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Save.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -259,14 +259,14 @@ public function execute()
259259
$data['backend_model'] = $this->productHelper->getAttributeBackendModelByInputType(
260260
$data['frontend_input']
261261
);
262+
263+
if ($model->getIsUserDefined() === null) {
264+
$data['backend_type'] = $model->getBackendTypeByInput($data['frontend_input']);
265+
}
262266
}
263267

264268
$data += ['is_filterable' => 0, 'is_filterable_in_search' => 0];
265269

266-
if ($model->getIsUserDefined() === null || $model->getIsUserDefined() != 0) {
267-
$data['backend_type'] = $model->getBackendTypeByInput($data['frontend_input']);
268-
}
269-
270270
$defaultValueField = $model->getDefaultValueByInput($data['frontend_input']);
271271
if ($defaultValueField) {
272272
$data['default_value'] = $this->getRequest()->getParam($defaultValueField);

app/code/Magento/Catalog/Model/ProductLink/CollectionProvider.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ public function getCollection(\Magento\Catalog\Model\Product $product, $type)
5858
}
5959

6060
usort($sorterItems, function ($itemA, $itemB) {
61-
$posA = intval($itemA['position']);
62-
$posB = intval($itemB['position']);
61+
$posA = (int)$itemA['position'];
62+
$posB = (int)$itemB['position'];
6363

6464
return $posA <=> $posB;
6565
});

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -257,11 +257,10 @@
257257
<arguments>
258258
<argument name="website" type="string"/>
259259
</arguments>
260-
<scrollTo selector="{{CreateProductSection.productInWebsite}}" stepKey="ScrollToWebsites"/>
261-
<click selector="{{CreateProductSection.productInWebsite}}" stepKey="ClickTpOpenProductInWebsite"/>
260+
<scrollTo selector="{{ProductInWebsitesSection.sectionHeader}}" stepKey="scrollToWebsites"/>
261+
<click selector="{{ProductInWebsitesSection.sectionHeader}}" stepKey="clickToOpenProductInWebsite"/>
262262
<waitForPageLoad stepKey="waitForPageOpened"/>
263-
<click selector="{{CreateProductSection.isSelected(website)}}" stepKey="SelectWebsite"/>
264-
<click selector="{{CreateProductSection.saveButton}}" stepKey="clickSaveProduct"/>
263+
<checkOption selector="{{ProductInWebsitesSection.website(website)}}" stepKey="selectWebsite"/>
265264
</actionGroup>
266265

267266
<!--Switch to New Store view-->

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

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,26 @@
2020
<click selector="{{AdminProductAttributeGridSection.FirstRow}}" stepKey="clickOnAttributeRow"/>
2121
<waitForPageLoad stepKey="waitForPageLoad2" />
2222
</actionGroup>
23+
<actionGroup name="navigateToEditProductAttribute">
24+
<arguments>
25+
<argument name="ProductAttribute" type="string"/>
26+
</arguments>
27+
<amOnPage url="{{AdminProductAttributeGridPage.url}}" stepKey="navigateToProductAttributeGrid"/>
28+
<waitForPageLoad stepKey="waitForPageLoad1"/>
29+
<fillField selector="{{AdminProductAttributeGridSection.GridFilterFrontEndLabel}}" userInput="{{ProductAttribute}}" stepKey="navigateToAttributeEditPage1" />
30+
<click selector="{{AdminProductAttributeGridSection.Search}}" stepKey="navigateToAttributeEditPage2" />
31+
<waitForPageLoad stepKey="waitForPageLoad2" />
32+
<click selector="{{AdminProductAttributeGridSection.FirstRow}}" stepKey="navigateToAttributeEditPage3" />
33+
<waitForPageLoad stepKey="waitForPageLoad3" />
34+
</actionGroup>
35+
<actionGroup name="changeUseForPromoRuleConditionsProductAttribute">
36+
<arguments>
37+
<argument name="option" type="string"/>
38+
</arguments>
39+
<click selector="{{StorefrontPropertiesSection.StoreFrontPropertiesTab}}" stepKey="clickStoreFrontPropertiesTab"/>
40+
<waitForPageLoad stepKey="waitForPageLoad"/>
41+
<selectOption selector="{{StorefrontPropertiesSection.useForPromoRuleConditions}}" userInput="{{option}}" stepKey="changeOption"/>
42+
<click selector="{{AttributePropertiesSection.Save}}" stepKey="saveAttribute"/>
43+
<see selector="{{AdminMessagesSection.success}}" userInput="You saved the product attribute." stepKey="successMessage"/>
44+
</actionGroup>
2345
</actionGroups>

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@
1515
<argument name="mode" type="string"/>
1616
<argument name="numOfProductsPerPage" type="string"/>
1717
<argument name="sortBy" type="string" defaultValue="position"/>
18+
<argument name="sort" type="string" defaultValue="asc"/>
1819
</arguments>
1920
<!-- Go to storefront category page -->
20-
<amOnPage url="{{StorefrontCategoryPage.url(category)}}?product_list_limit={{numOfProductsPerPage}}&amp;product_list_mode={{mode}}&amp;product_list_order={{sortBy}}" stepKey="onCategoryPage"/>
21+
<amOnPage url="{{StorefrontCategoryPage.url(category)}}?product_list_limit={{numOfProductsPerPage}}&amp;product_list_mode={{mode}}&amp;product_list_order={{sortBy}}&amp;product_list_dir={{sort}}" stepKey="onCategoryPage"/>
2122
<waitForPageLoad stepKey="waitForPageLoad"/>
2223
</actionGroup>
2324

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,8 @@
1616
<data key="store_id">0</data>
1717
<data key="label" unique="suffix">attributeTwo</data>
1818
</entity>
19+
<entity name="ProductAttributeFrontendLabelThree" type="FrontendLabel">
20+
<data key="store_id">0</data>
21+
<data key="label" unique="suffix">attributeThree</data>
22+
</entity>
1923
</entities>

app/code/Magento/Catalog/Test/Mftf/Page/StorefrontProductPage.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
<pages xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1010
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/PageObject.xsd">
11-
<page name="StorefrontProductPage" url="/{{var1}}.html" area="storefront" module="Catalog" parameterized="true">
11+
<page name="StorefrontProductPage" url="/{{var1}}.html" area="storefront" module="Magento_Catalog" parameterized="true">
1212
<section name="StorefrontProductInfoMainSection" />
1313
<section name="StorefrontProductInfoDetailsSection" />
1414
<section name="WYSIWYGToolbarSection"/>

0 commit comments

Comments
 (0)