-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge 2.4-develop into bug/wrong-behavior-of-grid-row-click
- Loading branch information
Showing
2,022 changed files
with
72,094 additions
and
13,094 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
app/code/Magento/AdminNotification/Test/Mftf/ActionGroup/AdminSystemMessagesActionGroup.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
189 changes: 189 additions & 0 deletions
189
app/code/Magento/AdvancedSearch/Test/Unit/Model/Recommendations/DataProviderTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.