Skip to content

Commit

Permalink
Merge 2.4-develop into bug/wrong-behavior-of-grid-row-click
Browse files Browse the repository at this point in the history
  • Loading branch information
Den4ik committed Dec 17, 2019
2 parents 27a57de + e385152 commit d2af286
Show file tree
Hide file tree
Showing 2,022 changed files with 72,094 additions and 13,094 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
[![Open Source Helpers](https://www.codetriage.com/magento/magento2/badges/users.svg)](https://www.codetriage.com/magento/magento2)
[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/magento/magento2?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
[![Crowdin](https://d322cqt584bo4o.cloudfront.net/magento-2/localized.svg)](https://crowdin.com/project/magento-2)
<h2>Welcome</h2>

## Welcome
Welcome to Magento 2 installation! We're glad you chose to install Magento 2, a cutting-edge, feature-rich eCommerce solution that gets results.

## Magento System Requirements
Expand Down Expand Up @@ -30,7 +31,7 @@ To suggest documentation improvements, click [here][4].
[4]: https://devdocs.magento.com

<h3>Community Maintainers</h3>
The members of this team have been recognized for their outstanding commitment to maintaining and improving Magento. Magento has granted them permission to accept, merge, and reject pull requests, as well as review issues, and thanks these Community Maintainers for their valuable contributions.
The members of this team have been recognized for their outstanding commitment to maintaining and improving Magento. Magento has granted them permission to accept, merge, and reject pull requests, as well as review issues, and thanks to these Community Maintainers for their valuable contributions.

<a href="https://magento.com/magento-contributors#maintainers">
<img src="https://raw.githubusercontent.com/wiki/magento/magento2/images/maintainers.png"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
<item name="text" xsi:type="string" translate="true"><![CDATA[
<p>Help us improve Magento Admin by allowing us to collect usage data.</p>
<p>All usage data that we collect for this purpose cannot be used to individually identify you and is used only to improve the Magento Admin and related products and services.</p>
<p>You can learn more and opt out at any time by following the instructions in <a href="https://docs.magento.com/m2/ce/user_guide/stores/admin.html" target="_blank">merchant documentation</a>.</p>
<p>You can learn more and opt out at any time by following the instructions in <a href="https://docs.magento.com/m2/ce/user_guide/stores/admin.html" target="_blank" tabindex="0">merchant documentation</a>.</p>
]]></item>
</item>
</argument>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,7 @@ define([
enableLogAction: '${ $.provider }:data.enableLogAction',
disableLogAction: '${ $.provider }:data.disableLogAction'
},
options: {
keyEventHandlers: {
/**
* Prevents escape key from exiting out of modal
*/
escapeKey: function () {
return;
}
}
},
options: {},
notificationWindow: null
},

Expand All @@ -41,11 +32,32 @@ define([
this._super();
},

/**
* Configure ESC and TAB so user can't leave modal
* without selecting an option
*
* @returns {Object} Chainable.
*/
initModalEvents: function () {
this._super();
//Don't allow ESC key to close modal
this.options.keyEventHandlers.escapeKey = this.handleEscKey.bind(this);
//Restrict tab action to the modal
this.options.keyEventHandlers.tabKey = this.handleTabKey.bind(this);

return this;
},

/**
* Once the modal is opened it hides the X
*/
onOpened: function () {
$('.modal-header button.action-close').hide();
$('.modal-header button.action-close').attr('disabled', true).hide();

this.focusableElements = $(this.rootSelector).find('a[href], button:enabled');
this.firstFocusableElement = this.focusableElements[0];
this.lastFocusableElement = this.focusableElements[this.focusableElements.length - 1];
this.firstFocusableElement.focus();
},

/**
Expand Down Expand Up @@ -104,11 +116,70 @@ define([
* Allows admin usage popup to be shown first and then new release notification
*/
openReleasePopup: function () {
var notifiModal = registry.get('release_notification.release_notification.notification_modal_1');
var notificationModalSelector = 'release_notification.release_notification.notification_modal_1';

if (analyticsPopupConfig.releaseVisible) {
notifiModal.initializeContentAfterAnalytics();
registry.get(notificationModalSelector).initializeContentAfterAnalytics();
}
},

/**
* Handle Tab and Shift+Tab key event
*
* Keep the tab actions restricted to the popup modal
* so the user must select an option to dismiss the modal
*/
handleTabKey: function (event) {
var modal = this,
KEY_TAB = 9;

/**
* Handle Shift+Tab to tab backwards
*/
function handleBackwardTab() {
if (document.activeElement === modal.firstFocusableElement ||
document.activeElement === $(modal.rootSelector)[0]
) {
event.preventDefault();
modal.lastFocusableElement.focus();
}
}

/**
* Handle Tab forward
*/
function handleForwardTab() {
if (document.activeElement === modal.lastFocusableElement) {
event.preventDefault();
modal.firstFocusableElement.focus();
}
}

switch (event.keyCode) {
case KEY_TAB:
if (modal.focusableElements.length === 1) {
event.preventDefault();
break;
}

if (event.shiftKey) {
handleBackwardTab();
break;
}
handleForwardTab();
break;
default:
break;
}
},

/**
* Handle Esc key
*
* Esc key should not close modal
*/
handleEscKey: function (event) {
event.preventDefault();
}
}
);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="AdminSystemMessagesWarningActionGroup">
<annotations>
<description>Check warning system message exists.</description>
</annotations>
<arguments>
<argument name="message" type="string"/>
</arguments>

<waitForElementVisible selector="{{AdminSystemMessagesSection.systemMessagesDropdown}}" stepKey="waitMessagesDropdownAppears"/>
<conditionalClick selector="{{AdminSystemMessagesSection.systemMessagesDropdown}}" dependentSelector="{{AdminSystemMessagesSection.messagesBlock}}" visible="false" stepKey="openMessagesBlockIfCollapsed"/>
<see userInput="{{message}}" selector="{{AdminSystemMessagesSection.warning}}" stepKey="seeWarningMessage"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,9 @@
<section name="AdminSystemMessagesSection">
<element name="systemMessagesDropdown" type="button" selector="#system_messages .message-system-action-dropdown"/>
<element name="actionMessageLog" type="button" selector="//*[contains(@class, 'message-system-summary')]/a[contains(text(), '{{textMessage}}')]" parameterized="true"/>
<element name="messagesBlock" type="block" selector="#system_messages div.message-system-collapsible"/>
<element name="success" type="text" selector="#system_messages div.message-success"/>
<element name="warning" type="text" selector="#system_messages div.message-warning"/>
<element name="notice" type="text" selector="#system_messages div.message-notice"/>
</section>
</sections>
Original file line number Diff line number Diff line change
@@ -0,0 +1,189 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

namespace Magento\AdvancedSearch\Test\Unit\Model\Recommendations;

use Magento\AdvancedSearch\Model\Recommendations\DataProvider;
use Magento\Framework\App\Config\ScopeConfigInterface;
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper;
use Magento\Catalog\Model\Layer\Resolver;
use Magento\AdvancedSearch\Model\ResourceModel\Recommendations;
use Magento\AdvancedSearch\Model\ResourceModel\RecommendationsFactory;
use Magento\Search\Model\QueryResult;
use Magento\Search\Model\QueryResultFactory;
use Magento\Catalog\Model\ResourceModel\Product\Collection as ProductCollection;
use Magento\Catalog\Model\Layer as SearchLayer;
use Magento\Store\Model\ScopeInterface;
use Magento\Search\Model\QueryInterface;

/**
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*
* Class \Magento\AdvancedSearch\Test\Unit\Model\Recommendations\DataProviderTest
*/
class DataProviderTest extends \PHPUnit\Framework\TestCase
{
/**
* @var DataProvider;
*/
private $model;

/**
* @var ObjectManagerHelper
*/
private $objectManagerHelper;

/**
* @var \PHPUnit_Framework_MockObject_MockObject|ScopeConfigInterface
*/
private $scopeConfigMock;

/**
* @var \PHPUnit_Framework_MockObject_MockObject|Resolver
*/
private $layerResolverMock;

/**
* @var \PHPUnit_Framework_MockObject_MockObject|SearchLayer
*/
private $searchLayerMock;

/**
* @var \PHPUnit_Framework_MockObject_MockObject|RecommendationsFactory
*/
private $recommendationsFactoryMock;

/**
* @var \PHPUnit_Framework_MockObject_MockObject|Recommendations
*/
private $recommendationsMock;

/**
* @var \PHPUnit_Framework_MockObject_MockObject|Resolver
*/
private $queryResultFactory;

/**
* Set up test environment.
*
* @return void
*/
protected function setUp()
{
$this->scopeConfigMock = $this->createMock(ScopeConfigInterface::class);
$this->layerResolverMock = $this->getMockBuilder(Resolver::class)
->disableOriginalConstructor()
->setMethods(['get'])
->getMock();

$this->searchLayerMock = $this->createMock(SearchLayer::class);

$this->layerResolverMock->expects($this->any())
->method('get')
->will($this->returnValue($this->searchLayerMock));

$this->recommendationsFactoryMock = $this->getMockBuilder(RecommendationsFactory::class)
->disableOriginalConstructor()
->setMethods(['create'])
->getMock();

$this->recommendationsMock = $this->createMock(Recommendations::class);

$this->queryResultFactory = $this->getMockBuilder(QueryResultFactory::class)
->disableOriginalConstructor()
->setMethods(['create'])
->getMock();

$this->objectManagerHelper = new ObjectManagerHelper($this);
$this->model = $this->objectManagerHelper->getObject(
DataProvider::class,
[
'scopeConfig' => $this->scopeConfigMock,
'layerResolver' => $this->layerResolverMock,
'recommendationsFactory' => $this->recommendationsFactoryMock,
'queryResultFactory' => $this->queryResultFactory
]
);
}

/**
* Test testGetItems() when Search Recommendations disabled.
*
* @return void
*/
public function testGetItemsWhenDisabledSearchRecommendations()
{
$isEnabledSearchRecommendations = false;

/** @var $queryInterfaceMock QueryInterface */
$queryInterfaceMock = $this->createMock(QueryInterface::class);

$this->scopeConfigMock->expects($this->any())
->method('isSetFlag')
->with('catalog/search/search_recommendations_enabled', ScopeInterface::SCOPE_STORE)
->willReturn($isEnabledSearchRecommendations);

$result = $this->model->getItems($queryInterfaceMock);
$this->assertEquals([], $result);
}

/**
* Test testGetItems() when Search Recommendations enabled.
*
* @return void
*/
public function testGetItemsWhenEnabledSearchRecommendations()
{
$storeId = 1;
$searchRecommendationsCountConfig = 2;
$isEnabledSearchRecommendations = true;
$queryText = 'test';

/** @var $queryInterfaceMock QueryInterface */
$queryInterfaceMock = $this->createMock(QueryInterface::class);
$queryInterfaceMock->expects($this->any())->method('getQueryText')->willReturn($queryText);

$this->scopeConfigMock->expects($this->any())
->method('isSetFlag')
->with('catalog/search/search_recommendations_enabled', ScopeInterface::SCOPE_STORE)
->willReturn($isEnabledSearchRecommendations);

$this->scopeConfigMock->expects($this->any())
->method('getValue')
->with('catalog/search/search_recommendations_count', ScopeInterface::SCOPE_STORE)
->willReturn($searchRecommendationsCountConfig);

$productCollectionMock = $this->createMock(ProductCollection::class);
$productCollectionMock->expects($this->any())->method('getStoreId')->willReturn($storeId);

$this->searchLayerMock->expects($this->any())->method('getProductCollection')
->willReturn($productCollectionMock);

$this->recommendationsFactoryMock->expects($this->any())->method('create')
->willReturn($this->recommendationsMock);

$this->recommendationsMock->expects($this->any())->method('getRecommendationsByQuery')
->with($queryText, ['store_id' => $storeId], $searchRecommendationsCountConfig)
->willReturn(
[
[
'query_text' => 'a',
'num_results' => 3
],
[
'query_text' => 'b',
'num_results' => 2
]
]
);
$queryResultMock = $this->createMock(QueryResult::class);
$this->queryResultFactory->expects($this->any())->method('create')->willReturn($queryResultMock);

$result = $this->model->getItems($queryInterfaceMock);
$this->assertEquals(2, count($result));
}
}
2 changes: 1 addition & 1 deletion app/code/Magento/AdvancedSearch/etc/adminhtml/system.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
<field id="search_suggestion_enabled">1</field>
</depends>
</field>
<field id="search_suggestion_count_results_enabled" translate="label" type="select" sortOrder="92" showInDefault="1" showInWebsite="1" showInStore="1">
<field id="search_suggestion_count_results_enabled" translate="label comment" type="select" sortOrder="92" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Show Results Count for Each Suggestion</label>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
<comment>When you enable this option your site may slow down.</comment>
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Analytics/Model/ExportDataHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public function __construct(
public function prepareExportData()
{
try {
$tmpDirectory = $this->filesystem->getDirectoryWrite(DirectoryList::VAR_DIR);
$tmpDirectory = $this->filesystem->getDirectoryWrite(DirectoryList::SYS_TMP);

$this->prepareDirectory($tmpDirectory, $this->getTmpFilesDirRelativePath());
$this->reportWriter->write($tmpDirectory, $this->getTmpFilesDirRelativePath());
Expand Down
Loading

0 comments on commit d2af286

Please sign in to comment.