Skip to content

Commit 98ec547

Browse files
[Magento Community Engineering] Community Contributions - 2.3-develop
- merged latest code from mainline branch
2 parents c16a1f4 + d440559 commit 98ec547

File tree

39 files changed

+1149
-62
lines changed

39 files changed

+1149
-62
lines changed

app/code/Magento/Backend/Block/Dashboard/Bar.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
*/
66
namespace Magento\Backend\Block\Dashboard;
77

8+
use Magento\Store\Model\Store;
9+
810
/**
911
* Adminhtml dashboard bar block
1012
*
@@ -23,6 +25,8 @@ class Bar extends \Magento\Backend\Block\Dashboard\AbstractDashboard
2325
protected $_currentCurrencyCode = null;
2426

2527
/**
28+
* Get totals
29+
*
2630
* @return array
2731
*/
2832
public function getTotals()
@@ -31,6 +35,8 @@ public function getTotals()
3135
}
3236

3337
/**
38+
* Add total
39+
*
3440
* @param string $label
3541
* @param float $value
3642
* @param bool $isQuantity
@@ -73,6 +79,7 @@ public function setCurrency($currency)
7379
* Retrieve currency model if not set then return currency model for current store
7480
*
7581
* @return \Magento\Directory\Model\Currency
82+
* @SuppressWarnings(PHPMD.RequestAwareBlockMethod)
7683
*/
7784
public function getCurrency()
7885
{
@@ -90,7 +97,8 @@ public function getCurrency()
9097
$this->getRequest()->getParam('group')
9198
)->getWebsite()->getBaseCurrency();
9299
} else {
93-
$this->_currentCurrencyCode = $this->_storeManager->getStore()->getBaseCurrency();
100+
$this->_currentCurrencyCode = $this->_storeManager->getStore(Store::DEFAULT_STORE_ID)
101+
->getBaseCurrency();
94102
}
95103
}
96104

app/code/Magento/Backend/Block/Widget/Grid/Column/Multistore.php

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
declare(strict_types=1);
7+
68
namespace Magento\Backend\Block\Widget\Grid\Column;
79

810
/**
@@ -14,15 +16,6 @@
1416
*/
1517
class Multistore extends \Magento\Backend\Block\Widget\Grid\Column
1618
{
17-
/**
18-
* @param \Magento\Backend\Block\Template\Context $context
19-
* @param array $data
20-
*/
21-
public function __construct(\Magento\Backend\Block\Template\Context $context, array $data = [])
22-
{
23-
parent::__construct($context, $data);
24-
}
25-
2619
/**
2720
* Get header css class name
2821
*

app/code/Magento/Backend/view/adminhtml/templates/store/switcher.phtml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
<?php if ($block->hasDefaultOption()) : ?>
3737
<li class="store-switcher-all <?php if (!($block->getDefaultSelectionName() != $block->getCurrentSelectionName())) : ?>disabled<?php endif; ?> <?php if (!$block->hasScopeSelected()) : ?>current<?php endif; ?>">
3838
<?php if ($block->getDefaultSelectionName() != $block->getCurrentSelectionName()) : ?>
39-
?>
4039
<a data-role="store-view-id" data-value="" href="#">
4140
<?= $block->escapeHtml($block->getDefaultSelectionName()) ?>
4241
</a>

app/code/Magento/Catalog/Helper/Product.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
/**
1515
* Catalog category helper
1616
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
17+
* @SuppressWarnings(PHPMD.CookieAndSessionMisuse)
1718
*/
1819
class Product extends \Magento\Framework\Url\Helper\Data
1920
{
@@ -268,6 +269,8 @@ public function getThumbnailUrl($product)
268269
}
269270

270271
/**
272+
* Retrieve email to friend url
273+
*
271274
* @param ModelProduct $product
272275
* @return string
273276
*/
@@ -282,6 +285,8 @@ public function getEmailToFriendUrl($product)
282285
}
283286

284287
/**
288+
* Get statuses
289+
*
285290
* @return array
286291
*/
287292
public function getStatuses()
@@ -476,6 +481,7 @@ public function initProduct($productId, $controller, $params = null)
476481

477482
/**
478483
* Prepares product options by buyRequest: retrieves values and assigns them as default.
484+
*
479485
* Also parses and adds product management related values - e.g. qty
480486
*
481487
* @param ModelProduct $product
@@ -493,6 +499,7 @@ public function prepareProductOptions($product, $buyRequest)
493499

494500
/**
495501
* Process $buyRequest and sets its options before saving configuration to some product item.
502+
*
496503
* This method is used to attach additional parameters to processed buyRequest.
497504
*
498505
* $params holds parameters of what operation must be performed:
@@ -541,8 +548,6 @@ public function addParamsToBuyRequest($buyRequest, $params)
541548
/**
542549
* Set flag that shows if Magento has to check product to be saleable (enabled and/or inStock)
543550
*
544-
* For instance, during order creation in the backend admin has ability to add any products to order
545-
*
546551
* @param bool $skipSaleableCheck
547552
* @return Product
548553
*/

app/code/Magento/Catalog/Plugin/Block/Topmenu.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@
1414
*/
1515
class Topmenu
1616
{
17+
/**
18+
* Cache tag for menu block
19+
*/
20+
private $cacheTag = "top_menu";
21+
1722
/**
1823
* Catalog category
1924
*
@@ -119,6 +124,7 @@ public function beforeGetIdentities(\Magento\Theme\Block\Html\Topmenu $subject)
119124
$subject->addIdentity(Category::CACHE_TAG);
120125
$rootId = $this->storeManager->getStore()->getRootCategoryId();
121126
$storeId = $this->storeManager->getStore()->getId();
127+
$currentCategory = $this->getCurrentCategory();
122128
/** @var \Magento\Catalog\Model\ResourceModel\Category\Collection $collection */
123129
$collection = $this->getCategoryTree($storeId, $rootId);
124130
$mapping = [$rootId => $subject->getMenu()]; // use nodes stack to avoid recursion
@@ -128,6 +134,9 @@ public function beforeGetIdentities(\Magento\Theme\Block\Html\Topmenu $subject)
128134
}
129135
$subject->addIdentity(Category::CACHE_TAG . '_' . $category->getId());
130136
}
137+
if ($currentCategory) {
138+
$subject->addIdentity($this->cacheTag . '_' . Category::CACHE_TAG . '_' . $currentCategory->getId());
139+
}
131140
}
132141

133142
/**

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,13 @@
4343
<selectOption selector="{{AdminProductFormNewAttributeSection.attributeType}}" userInput="{{attributeType}}" stepKey="selectAttributeType"/>
4444
<click selector="{{AdminProductFormNewAttributeSection.saveAttribute}}" stepKey="saveAttribute"/>
4545
</actionGroup>
46+
<actionGroup name="AdminCreateAttributeFromProductPageWithScope" extends="AdminCreateAttributeFromProductPage" insertAfter="selectAttributeType">
47+
<arguments>
48+
<argument name="scope" type="string" defaultValue="Store View"/>
49+
</arguments>
50+
<conditionalClick selector="{{AdminProductFormNewAttributeAdvancedSection.sectionHeader}}" dependentSelector="{{AdminProductFormNewAttributeAdvancedSection.scope}}" visible="false" stepKey="openAttributeAdvancedSection"/>
51+
<selectOption selector="{{AdminProductFormNewAttributeAdvancedSection.scope}}" userInput="{{scope}}" stepKey="selectScope"/>
52+
</actionGroup>
4653

4754
<actionGroup name="AdminCreateAttributeWithValueWithTwoStoreViesFromProductPage" extends="AdminCreateAttributeFromProductPage">
4855
<remove keyForRemoval="saveAttribute"/>

app/code/Magento/Catalog/Test/Mftf/Section/AdminCategorySidebarTreeSection.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
<element name="expandAll" type="button" selector=".tree-actions a:last-child"/>
1414
<element name="categoryTreeRoot" type="text" selector="div.x-tree-root-node>li.x-tree-node:first-of-type>div.x-tree-node-el:first-of-type" timeout="30"/>
1515
<element name="categoryInTree" type="text" selector="//a/span[contains(text(), '{{name}}')]" parameterized="true" timeout="30"/>
16+
<element name="categoryHighlighted" type="text" selector="//ul[@id='ui-id-2']//li//a/span[contains(text(),'{{name}}')]/../.." parameterized="true" timeout="30"/>
17+
<element name="categoryNotHighlighted" type="text" selector="ul[id=\'ui-id-2\'] li[class~=\'active\']" timeout="30"/>
1618
<element name="categoryInTreeUnderRoot" type="text" selector="//li/ul/li[@class='x-tree-node']/div/a/span[contains(text(), '{{name}}')]" parameterized="true"/>
1719
<element name="lastCreatedCategory" type="block" selector=".x-tree-root-ct li li:last-child" />
1820
<element name="treeContainer" type="block" selector=".tree-holder" />

app/code/Magento/Catalog/Test/Mftf/Section/AdminProductFormAttributeSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
<section name="AdminProductFormNewAttributeAdvancedSection">
2626
<element name="sectionHeader" type="button" selector="div[data-index='advanced_fieldset']"/>
2727
<element name="defaultValue" type="textarea" selector="input[name='default_value_text']"/>
28+
<element name="scope" type="select" selector="//div[@data-index='advanced_fieldset']//select[@name='is_global']"/>
2829
</section>
2930
<section name="AdminProductFormNewAttributeStorefrontSection">
3031
<element name="sectionHeader" type="button" selector="div[data-index='front_fieldset']"/>
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
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="CheckCurrentCategoryIsHighlightedAndProductsDisplayed">
12+
<annotations>
13+
<features value="Catalog"/>
14+
<title value="Сheck that current category is highlighted and all products displayed for it"/>
15+
<description value="Сheck that current category is highlighted and all products displayed for it"/>
16+
<severity value="MAJOR"/>
17+
<testCaseId value="MAGETWO-99028"/>
18+
<useCaseId value="MAGETWO-98748"/>
19+
<group value="Catalog"/>
20+
</annotations>
21+
<before>
22+
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
23+
<createData entity="SimpleSubCategory" stepKey="category1"/>
24+
<createData entity="SimpleSubCategory" stepKey="category2"/>
25+
<createData entity="SimpleSubCategory" stepKey="category3"/>
26+
<createData entity="SimpleSubCategory" stepKey="category4"/>
27+
<createData entity="SimpleProduct" stepKey="product1">
28+
<requiredEntity createDataKey="category1"/>
29+
</createData>
30+
<createData entity="SimpleProduct" stepKey="product2">
31+
<requiredEntity createDataKey="category1"/>
32+
</createData>
33+
</before>
34+
<after>
35+
<deleteData createDataKey="product1" stepKey="deleteProduct1"/>
36+
<deleteData createDataKey="product2" stepKey="deleteProduct2"/>
37+
<deleteData createDataKey="category1" stepKey="deleteCategory1"/>
38+
<deleteData createDataKey="category2" stepKey="deleteCategory2"/>
39+
<deleteData createDataKey="category3" stepKey="deleteCategory3"/>
40+
<deleteData createDataKey="category4" stepKey="deleteCategory4"/>
41+
<actionGroup ref="logout" stepKey="logout"/>
42+
</after>
43+
<!--Open Storefront home page-->
44+
<comment userInput="Open Storefront home page" stepKey="openStorefrontHomePage"/>
45+
<amOnPage url="{{StorefrontHomePage.url}}" stepKey="goToStorefrontHomePage"/>
46+
<waitForPageLoad stepKey="waitForSimpleProductPage"/>
47+
<!--Click on first category-->
48+
<comment userInput="Click on first category" stepKey="openFirstCategoryPage"/>
49+
<click selector="{{AdminCategorySidebarTreeSection.categoryInTree($$category1.name$$)}}" stepKey="clickCategory1Name"/>
50+
<waitForPageLoad stepKey="waitForCategory1Page"/>
51+
<!--Check if current category is highlighted and the others are not-->
52+
<comment userInput="Check if current category is highlighted and the others are not" stepKey="checkCateg1NameIsHighlighted"/>
53+
<grabAttributeFrom selector="{{AdminCategorySidebarTreeSection.categoryHighlighted($$category1.name$$)}}" userInput="class" stepKey="grabCategory1Class"/>
54+
<assertContains expectedType="string" expected="active" actual="$grabCategory1Class" stepKey="assertCategory1IsHighlighted"/>
55+
<executeJS function="return document.querySelectorAll('{{AdminCategorySidebarTreeSection.categoryNotHighlighted}}').length" stepKey="highlightedAmount"/>
56+
<assertEquals expectedType="int" expected="1" actual="$highlightedAmount" stepKey="assertRestCategories1IsNotHighlighted"/>
57+
<!--See products in the category page-->
58+
<comment userInput="See products in the category page" stepKey="seeProductsInCategoryPage"/>
59+
<seeElement selector="{{StorefrontCategoryMainSection.specifiedProductItemInfo($product1.name$)}}" stepKey="seeProduct1InCategoryPage"/>
60+
<seeElement selector="{{StorefrontCategoryMainSection.specifiedProductItemInfo($product2.name$)}}" stepKey="seeProduct2InCategoryPage"/>
61+
<!--Click on second category-->
62+
<comment userInput="Click on second category" stepKey="openSecondCategoryPage"/>
63+
<click selector="{{AdminCategorySidebarTreeSection.categoryInTree($$category2.name$$)}}" stepKey="clickCategory2Name"/>
64+
<waitForPageLoad stepKey="waitForCategory2Page"/>
65+
<!--Check if current category is highlighted and the others are not-->
66+
<comment userInput="Check if current category is highlighted and the others are not" stepKey="checkCateg2NameIsHighlighted"/>
67+
<grabAttributeFrom selector="{{AdminCategorySidebarTreeSection.categoryHighlighted($$category2.name$$)}}" userInput="class" stepKey="grabCategory2Class"/>
68+
<assertContains expectedType="string" expected="active" actual="$grabCategory2Class" stepKey="assertCategory2IsHighlighted"/>
69+
<executeJS function="return document.querySelectorAll('{{AdminCategorySidebarTreeSection.categoryNotHighlighted}}').length" stepKey="highlightedAmount2"/>
70+
<assertEquals expectedType="int" expected="1" actual="$highlightedAmount2" stepKey="assertRestCategories1IsNotHighlighted2"/>
71+
</test>
72+
</tests>

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,13 @@
2121
<waitForPageLoad stepKey="waitSaveToBeApplied"/>
2222
<see selector="{{AdminProductMessagesSection.successMessage}}" userInput="You saved the page." stepKey="seeSaveSuccess"/>
2323
</actionGroup>
24+
<actionGroup name="ClearWidgetsForCMSHomePageContentWYSIWYGDisabled">
25+
<amOnPage url="{{CmsPageEditPage.url('2')}}" stepKey="navigateToEditHomePagePage"/>
26+
<waitForPageLoad stepKey="waitForCmsPageEditPage"/>
27+
<conditionalClick selector="{{CmsNewPagePageActionsSection.contentSectionName}}" dependentSelector="{{CatalogWidgetSection.insertWidgetButton}}" visible="false" stepKey="clickShowHideEditorIfVisible"/>
28+
<waitForElementVisible selector="{{CmsNewPagePageContentSection.content}}" stepKey="waitForContentField"/>
29+
<fillField selector="{{CmsNewPagePageContentSection.content}}" userInput="CMS homepage content goes here." stepKey="resetCMSPageToDefaultContent"/>
30+
<click selector="{{CmsNewPagePageActionsSection.saveAndContinueEdit}}" stepKey="clickSave"/>
31+
<waitForPageLoad stepKey="waitForSettingsApply"/>
32+
</actionGroup>
2433
</actionGroups>

0 commit comments

Comments
 (0)