Skip to content

Commit b56e52e

Browse files
[EngCom] Public Pull Requests - 2.3-develop
- merged latest code from mainline branch
2 parents 0533dc2 + 68a02ca commit b56e52e

File tree

106 files changed

+2860
-412
lines changed

Some content is hidden

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

106 files changed

+2860
-412
lines changed

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ private function isUniqueAdminValues(array $optionsValues, array $deletedOptions
163163
{
164164
$adminValues = [];
165165
foreach ($optionsValues as $optionKey => $values) {
166-
if (!(isset($deletedOptions[$optionKey]) and $deletedOptions[$optionKey] === '1')) {
166+
if (!(isset($deletedOptions[$optionKey]) && $deletedOptions[$optionKey] === '1')) {
167167
$adminValues[] = reset($values);
168168
}
169169
}

app/code/Magento/CatalogSearch/Model/Adapter/Mysql/Aggregation/DataProvider.php

+20-3
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,11 @@
1616
use Magento\Framework\DB\Select;
1717
use Magento\Framework\Search\Adapter\Mysql\Aggregation\DataProviderInterface;
1818
use Magento\Framework\Search\Request\BucketInterface;
19+
use Magento\Framework\Event\Manager;
1920

2021
/**
22+
* Data Provider for catalog search.
23+
*
2124
* @deprecated
2225
* @see \Magento\ElasticSearch
2326
*/
@@ -43,12 +46,18 @@ class DataProvider implements DataProviderInterface
4346
*/
4447
private $selectBuilderForAttribute;
4548

49+
/**
50+
* @var Manager
51+
*/
52+
private $eventManager;
53+
4654
/**
4755
* @param Config $eavConfig
4856
* @param ResourceConnection $resource
4957
* @param ScopeResolverInterface $scopeResolver
5058
* @param null $customerSession @deprecated
5159
* @param SelectBuilderForAttribute|null $selectBuilderForAttribute
60+
* @param Manager|null $eventManager
5261
*
5362
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
5463
*/
@@ -57,17 +66,19 @@ public function __construct(
5766
ResourceConnection $resource,
5867
ScopeResolverInterface $scopeResolver,
5968
$customerSession,
60-
SelectBuilderForAttribute $selectBuilderForAttribute = null
69+
SelectBuilderForAttribute $selectBuilderForAttribute = null,
70+
Manager $eventManager = null
6171
) {
6272
$this->eavConfig = $eavConfig;
6373
$this->connection = $resource->getConnection();
6474
$this->scopeResolver = $scopeResolver;
6575
$this->selectBuilderForAttribute = $selectBuilderForAttribute
6676
?: ObjectManager::getInstance()->get(SelectBuilderForAttribute::class);
77+
$this->eventManager = $eventManager ?: ObjectManager::getInstance()->get(Manager::class);
6778
}
6879

6980
/**
70-
* {@inheritdoc}
81+
* @inheritdoc
7182
*/
7283
public function getDataSet(
7384
BucketInterface $bucket,
@@ -83,20 +94,26 @@ public function getDataSet(
8394
'main_table.entity_id = entities.entity_id',
8495
[]
8596
);
97+
$this->eventManager->dispatch(
98+
'catalogsearch_query_add_filter_after',
99+
['bucket' => $bucket, 'select' => $select]
100+
);
86101
$select = $this->selectBuilderForAttribute->build($select, $attribute, $currentScope);
87102

88103
return $select;
89104
}
90105

91106
/**
92-
* {@inheritdoc}
107+
* @inheritdoc
93108
*/
94109
public function execute(Select $select)
95110
{
96111
return $this->connection->fetchAssoc($select);
97112
}
98113

99114
/**
115+
* Get select.
116+
*
100117
* @return Select
101118
*/
102119
private function getSelect()

app/code/Magento/CatalogSearch/Model/Layer/Filter/Attribute.php

+8
Original file line numberDiff line numberDiff line change
@@ -153,4 +153,12 @@ private function getOptionCount($value, $optionsFacetedData)
153153
? (int)$optionsFacetedData[$value]['count']
154154
: 0;
155155
}
156+
157+
/**
158+
* @inheritdoc
159+
*/
160+
protected function isOptionReducesResults($optionCount, $totalSize)
161+
{
162+
return $optionCount <= $totalSize;
163+
}
156164
}

app/code/Magento/CatalogSearch/Test/Unit/Model/Adapter/Mysql/Aggregation/DataProviderTest.php

+11-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
use Magento\Eav\Model\Entity\Attribute;
2121
use Magento\Catalog\Model\Product;
2222
use Magento\Framework\DB\Ddl\Table;
23+
use Magento\Framework\Event\Manager;
2324

2425
/**
2526
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
@@ -64,6 +65,11 @@ class DataProviderTest extends \PHPUnit\Framework\TestCase
6465
*/
6566
private $selectBuilderForAttribute;
6667

68+
/**
69+
* @var Manager|\PHPUnit_Framework_MockObject_MockObject
70+
*/
71+
private $eventManager;
72+
6773
protected function setUp()
6874
{
6975
$this->eavConfigMock = $this->createMock(Config::class);
@@ -73,12 +79,14 @@ protected function setUp()
7379
$this->adapterMock = $this->createMock(AdapterInterface::class);
7480
$this->resourceConnectionMock->expects($this->once())->method('getConnection')->willReturn($this->adapterMock);
7581
$this->selectBuilderForAttribute = $this->createMock(SelectBuilderForAttribute::class);
82+
$this->eventManager = $this->createMock(Manager::class);
7683
$this->model = new DataProvider(
7784
$this->eavConfigMock,
7885
$this->resourceConnectionMock,
7986
$this->scopeResolverMock,
8087
$this->sessionMock,
81-
$this->selectBuilderForAttribute
88+
$this->selectBuilderForAttribute,
89+
$this->eventManager
8290
);
8391
}
8492

@@ -102,6 +110,7 @@ public function testGetDataSetUsesFrontendPriceIndexerTableIfAttributeIsPrice()
102110

103111
$selectMock = $this->createMock(Select::class);
104112
$this->adapterMock->expects($this->atLeastOnce())->method('select')->willReturn($selectMock);
113+
$this->eventManager->expects($this->once())->method('dispatch')->willReturn($selectMock);
105114
$tableMock = $this->createMock(Table::class);
106115

107116
$this->model->getDataSet($bucketMock, ['scope' => $dimensionMock], $tableMock);
@@ -129,6 +138,7 @@ public function testGetDataSetUsesFrontendPriceIndexerTableForDecimalAttributes(
129138
$selectMock = $this->createMock(Select::class);
130139
$this->selectBuilderForAttribute->expects($this->once())->method('build')->willReturn($selectMock);
131140
$this->adapterMock->expects($this->atLeastOnce())->method('select')->willReturn($selectMock);
141+
$this->eventManager->expects($this->once())->method('dispatch')->willReturn($selectMock);
132142
$tableMock = $this->createMock(Table::class);
133143
$this->model->getDataSet($bucketMock, ['scope' => $dimensionMock], $tableMock);
134144
}

app/code/Magento/Checkout/Test/Mftf/Section/CheckoutSuccessRegisterSection.xml

+1
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,6 @@
1212
<element name="registerMessage" type="text" selector="#registration p:nth-child(1)"/>
1313
<element name="customerEmail" type="text" selector="#registration p:nth-child(2)"/>
1414
<element name="createAccountButton" type="button" selector="#registration form input[type='submit']" timeout="30"/>
15+
<element name="orderNumber" type="text" selector="//p[text()='Your order # is: ']//span"/>
1516
</section>
1617
</sections>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
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="StoreFrontCheckCustomerInfoCreatedByGuestTest">
12+
<annotations>
13+
<features value="Checkout"/>
14+
<stories value="Check customer information created by guest"/>
15+
<title value="Check Customer Information Created By Guest"/>
16+
<description value="Check customer information after placing the order as the guest who created an account"/>
17+
<severity value="MAJOR"/>
18+
<testCaseId value="MAGETWO-95932"/>
19+
<useCaseId value="MAGETWO-95820"/>
20+
<group value="checkout"/>
21+
</annotations>
22+
23+
<before>
24+
<createData entity="_defaultCategory" stepKey="category"/>
25+
<createData entity="_defaultProduct" stepKey="product">
26+
<requiredEntity createDataKey="category"/>
27+
</createData>
28+
<magentoCLI command="cache:flush" stepKey="flushCache"/>
29+
</before>
30+
31+
<after>
32+
<deleteData createDataKey="product" stepKey="deleteProduct" />
33+
<deleteData createDataKey="category" stepKey="deleteCategory" />
34+
<actionGroup ref="logout" stepKey="logoutFromAdmin"/>
35+
</after>
36+
37+
<amOnPage url="$$product.name$$.html" stepKey="navigateToProductPage"/>
38+
<waitForPageLoad stepKey="waitForProductPage"/>
39+
<actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addToCartFromStorefrontProductPage">
40+
<argument name="productName" value="$$product.name$$"/>
41+
</actionGroup>
42+
<actionGroup ref="GoToCheckoutFromMinicartActionGroup" stepKey="goToCheckoutFromMinicart"/>
43+
<actionGroup ref="GuestCheckoutFillingShippingSectionActionGroup" stepKey="guestCheckoutFillingShippingSection">
44+
<argument name="customerVar" value="CustomerEntityOne"/>
45+
<argument name="customerAddressVar" value="CustomerAddressSimple"/>
46+
</actionGroup>
47+
<actionGroup ref="CheckoutPlaceOrderActionGroup" stepKey="placeOrder">
48+
<argument name="orderNumberMessage" value="CONST.successGuestCheckoutOrderNumberMessage"/>
49+
<argument name="emailYouMessage" value="CONST.successCheckoutEmailYouMessage" />
50+
</actionGroup>
51+
<grabTextFrom selector="{{CheckoutSuccessRegisterSection.orderNumber}}" stepKey="grabOrderNumber"/>
52+
<click selector="{{CheckoutSuccessRegisterSection.createAccountButton}}" stepKey="clickCreateAccountButton"/>
53+
<fillField selector="{{StorefrontCustomerCreateFormSection.passwordField}}" userInput="{{CustomerEntityOne.password}}" stepKey="TypePassword"/>
54+
<fillField selector="{{StorefrontCustomerCreateFormSection.confirmPasswordField}}" userInput="{{CustomerEntityOne.password}}" stepKey="TypeConfirmationPassword"/>
55+
<click selector="{{StorefrontCustomerCreateFormSection.createAccountButton}}" stepKey="clickOnCreateAccount"/>
56+
<see userInput="Thank you for registering" stepKey="verifyAccountCreated"/>
57+
<actionGroup ref="LoginAsAdmin" stepKey="loginToAdmin"/>
58+
<amOnPage url="{{AdminOrderPage.url({$grabOrderNumber})}}" stepKey="navigateToOrderPage"/>
59+
<waitForPageLoad stepKey="waitForCreatedOrderPage"/>
60+
<see stepKey="seeCustomerName" userInput="{{CustomerEntityOne.firstname}}" selector="{{AdminShipmentOrderInformationSection.customerName}}"/>
61+
</test>
62+
</tests>

app/code/Magento/Cms/Test/Mftf/ActionGroup/CMSActionGroup.xml

+16
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,20 @@
4444
<waitForPageLoad stepKey="waitForPageLoad3"/>
4545
<waitForLoadingMaskToDisappear stepKey="waitForLoadingMaskOfStagingSection" />
4646
</actionGroup>
47+
48+
<actionGroup name="AddStoreViewToCmsPage" extends="navigateToCreatedCMSPage">
49+
<arguments>
50+
<argument name="storeViewName" type="string"/>
51+
</arguments>
52+
<remove keyForRemoval="clickExpandContentTabForPage"/>
53+
<remove keyForRemoval="waitForLoadingMaskOfStagingSection"/>
54+
<click selector="{{CmsNewPagePiwSection.header}}" stepKey="clickPageInWebsites" after="waitForPageLoad3"/>
55+
<waitForElementVisible selector="{{CmsNewPagePiwSection.selectStoreView(storeViewName)}}" stepKey="waitForStoreGridReload"/>
56+
<clickWithLeftButton selector="{{CmsNewPagePiwSection.selectStoreView(storeViewName)}}" stepKey="clickStoreView"/>
57+
<click selector="{{CmsNewPagePageActionsSection.expandSplitButton}}" stepKey="expandButtonMenu"/>
58+
<waitForElementVisible selector="{{CmsNewPagePageActionsSection.splitButtonMenu}}" stepKey="waitForSplitButtonMenuVisible"/>
59+
<click selector="{{CmsNewPagePageActionsSection.savePage}}" stepKey="clickSavePage"/>
60+
<waitForPageLoad stepKey="waitForPageLoad"/>
61+
<see userInput="You saved the page." stepKey="seeMessage"/>
62+
</actionGroup>
4763
</actionGroups>

app/code/Magento/Cms/Test/Mftf/Test/AdminAddWidgetToWYSIWYGWithCMSPageLinkTypeTest.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
<see userInput="Inserting a widget does not create a widget instance." stepKey="seeMessage" />
3737
<!--see Insert Widget button disabled-->
3838
<see selector="{{WidgetSection.InsertWidgetBtnDisabled}}" userInput="Insert Widget" stepKey="seeInsertWidgetDisabled" />
39-
<!--see Cancel button enabed-->
39+
<!--see Cancel button enabled-->
4040
<see selector="{{WidgetSection.CancelBtnEnabled}}" userInput="Cancel" stepKey="seeCancelBtnEnabled" />
4141
<!--Select "Widget Type"-->
4242
<selectOption selector="{{WidgetSection.WidgetType}}" userInput="CMS Page Link" stepKey="selectCMSPageLink" />

app/code/Magento/Cms/Test/Mftf/Test/AdminAddWidgetToWYSIWYGWithCatalogProductListTypeTest.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
<see userInput="Inserting a widget does not create a widget instance." stepKey="seeMessage" />
4343
<!--see Insert Widget button disabled-->
4444
<see selector="{{WidgetSection.InsertWidgetBtnDisabled}}" userInput="Insert Widget" stepKey="seeInsertWidgetDisabled" />
45-
<!--see Cancel button enabed-->
45+
<!--see Cancel button enabled-->
4646
<see selector="{{WidgetSection.CancelBtnEnabled}}" userInput="Cancel" stepKey="seeCancelBtnEnabled" />
4747
<!--Select "Widget Type"-->
4848
<selectOption selector="{{WidgetSection.WidgetType}}" userInput="Catalog Products List" stepKey="selectCatalogProductsList" />

app/code/Magento/Cms/Test/Mftf/Test/AdminAddWidgetToWYSIWYGWithRecentlyComparedProductsTypeTest.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
<waitForPageLoad stepKey="wait2"/>
4242
<!--see Insert Widget button disabled-->
4343
<see selector="{{WidgetSection.InsertWidgetBtnDisabled}}" userInput="Insert Widget" stepKey="seeInsertWidgetDisabled" />
44-
<!--see Cancel button enabed-->
44+
<!--see Cancel button enabled-->
4545
<see selector="{{WidgetSection.CancelBtnEnabled}}" userInput="Cancel" stepKey="seeCancelBtnEnabled" />
4646
<!--Select "Widget Type"-->
4747
<selectOption selector="{{WidgetSection.WidgetType}}" userInput="Recently Compared Products" stepKey="selectRecentlyComparedProducts" />

app/code/Magento/Cms/Test/Mftf/Test/AdminAddWidgetToWYSIWYGWithRecentlyViewedProductsTypeTest.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
<see userInput="Inserting a widget does not create a widget instance." stepKey="seeMessage" />
4141
<!--see Insert Widget button disabled-->
4242
<see selector="{{WidgetSection.InsertWidgetBtnDisabled}}" userInput="Insert Widget" stepKey="seeInsertWidgetDisabled" />
43-
<!--see Cancel button enabed-->
43+
<!--see Cancel button enabled-->
4444
<see selector="{{WidgetSection.CancelBtnEnabled}}" userInput="Cancel" stepKey="seeCancelBtnEnabled" />
4545
<!--Select "Widget Type"-->
4646
<selectOption selector="{{WidgetSection.WidgetType}}" userInput="Recently Viewed Products" stepKey="selectRecentlyViewedProducts" />
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
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="StoreViewLanguageCorrectSwitchTest">
12+
<annotations>
13+
<features value="Cms"/>
14+
<stories value="Store View (language) switch leads to 404"/>
15+
<group value="Cms"/>
16+
<title value="Check that Store View(language) switches correct"/>
17+
<description value="Check that Store View(language) switches correct"/>
18+
<severity value="MAJOR"/>
19+
<testCaseId value="MAGETWO-96388"/>
20+
<useCaseId value="MAGETWO-57337"/>
21+
</annotations>
22+
<before>
23+
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
24+
25+
<!-- Create Cms Pages -->
26+
<createData entity="_newDefaultCmsPage" stepKey="createFirstCmsPage"/>
27+
<createData entity="_newDefaultCmsPage" stepKey="createSecondCmsPage"/>
28+
</before>
29+
<after>
30+
<deleteData createDataKey="createFirstCmsPage" stepKey="deleteFirstCmsPage"/>
31+
<deleteData createDataKey="createSecondCmsPage" stepKey="deleteSecondCmsPage"/>
32+
<actionGroup ref="AdminDeleteStoreViewActionGroup" stepKey="deleteStoreView">
33+
<argument name="customStore" value="NewStoreViewData"/>
34+
</actionGroup>
35+
<actionGroup ref="logout" stepKey="logout"/>
36+
</after>
37+
38+
<!-- Create StoreView -->
39+
<actionGroup ref="AdminCreateStoreViewActionGroup" stepKey="createStoreView">
40+
<argument name="customStore" value="NewStoreViewData"/>
41+
</actionGroup>
42+
43+
<!-- Add StoreView To Cms Page-->
44+
<actionGroup ref="AddStoreViewToCmsPage" stepKey="gotToCmsPage">
45+
<argument name="CMSPage" value="$$createSecondCmsPage$$"/>
46+
<argument name="storeViewName" value="{{NewStoreViewData.name}}"/>
47+
</actionGroup>
48+
49+
<!-- Check that Cms Page is open -->
50+
<amOnPage url="{{StorefrontHomePage.url}}/$$createFirstCmsPage.identifier$$" stepKey="gotToFirstCmsPage"/>
51+
<see userInput="$$createFirstCmsPage.title$$" stepKey="seePageTitle"/>
52+
53+
<!-- Switch StoreView and check that Cms Page is open -->
54+
<click selector="{{StorefrontHeaderSection.storeViewSwitcher}}" stepKey="clickStoreViewSwitcher"/>
55+
<waitForElementVisible selector="{{StorefrontHeaderSection.storeViewDropdown}}" stepKey="waitForStoreViewDropDown"/>
56+
<click selector="{{StorefrontHeaderSection.storeViewOption(NewStoreViewData.code)}}" stepKey="selectStoreView"/>
57+
<amOnPage url="{{StorefrontHomePage.url}}/$$createSecondCmsPage.identifier$$" stepKey="gotToSecondCmsPage"/>
58+
<see userInput="$$createSecondCmsPage.title$$" stepKey="seePageTitle1"/>
59+
</test>
60+
</tests>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
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+
<entities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataProfileSchema.xsd">
11+
<entity name="EnableAllowGuestCheckout" type="allow_guest_checkout_config">
12+
<requiredEntity type="guest_checkout">AllowGuestCheckoutYes</requiredEntity>
13+
</entity>
14+
<entity name="AllowGuestCheckoutYes" type="guest_checkout">
15+
<data key="value">1</data>
16+
</entity>
17+
18+
<entity name="DisableAllowGuestCheckout" type="allow_guest_checkout_config">
19+
<requiredEntity type="guest_checkout">AllowGuestCheckoutNo</requiredEntity>
20+
</entity>
21+
<entity name="AllowGuestCheckoutNo" type="guest_checkout">
22+
<data key="value">0</data>
23+
</entity>
24+
</entities>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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+
<operations xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataOperation.xsd">
10+
<operation name="AllowGuestCheckoutConfig" dataType="allow_guest_checkout_config" type="create" auth="adminFormKey" url="/admin/system_config/save/section/checkout/" method="POST">
11+
<object key="groups" dataType="allow_guest_checkout_config">
12+
<object key="options" dataType="allow_guest_checkout_config">
13+
<object key="fields" dataType="allow_guest_checkout_config">
14+
<object key="guest_checkout" dataType="guest_checkout">
15+
<field key="value">string</field>
16+
</object>
17+
</object>
18+
</object>
19+
</object>
20+
</operation>
21+
</operations>

0 commit comments

Comments
 (0)