Skip to content

Commit 24a2c46

Browse files
authored
Merge pull request #7895 from magento-gl/Hammer_Community_Backlog_21092022
Hammer community backlog 21092022
2 parents eb1e3a0 + 8789c70 commit 24a2c46

File tree

10 files changed

+122
-31
lines changed

10 files changed

+122
-31
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,7 @@
4141
<element name="productNameByPosition" type="text" selector=".products-grid li:nth-of-type({{position}}) .product-item-name a" parameterized="true"/>
4242
<element name="sidebarAdditional" type="block" selector="#maincontent .sidebar.sidebar-additional"/>
4343
<element name="searchStore" type="input" selector="//div/input[@id='search']" />
44+
<element name="productAttributeName" type="button" selector="//div[@class='filter-options-title' and contains(text(),'{{var1}}')]" parameterized="true"/>
45+
<element name="productAttributeOptionValue" type="button" selector="//div[@id='narrow-by-list']//a[contains(text(), '{{var1}}')]" parameterized="true"/>
4446
</section>
4547
</sections>

app/code/Magento/Cms/Block/Page.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ protected function _addBreadcrumbs(\Magento\Cms\Model\Page $page)
135135
'web/default/cms_no_route',
136136
ScopeInterface::SCOPE_STORE
137137
);
138-
$noRouteDelimiterPosition = strrpos($noRouteIdentifier, '|');
138+
$noRouteDelimiterPosition = $noRouteIdentifier === null ? false : strrpos($noRouteIdentifier, '|');
139139
if ($noRouteDelimiterPosition) {
140140
$noRouteIdentifier = substr($noRouteIdentifier, 0, $noRouteDelimiterPosition);
141141
}

app/code/Magento/Elasticsearch/Model/ResourceModel/Fulltext/Collection/SearchResultApplier.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,6 @@ private function categoryProductByCustomSortOrder(int $categoryId): array
211211
$searchCriteria = $this->searchResult->getSearchCriteria();
212212
$sortOrders = $searchCriteria->getSortOrders() ?? [];
213213
$sortOrders = array_merge(['is_salable' => \Magento\Framework\DB\Select::SQL_DESC], $sortOrders);
214-
215214
$connection = $this->collection->getConnection();
216215
$query = clone $connection->select()
217216
->reset(\Magento\Framework\DB\Select::ORDER)
@@ -231,6 +230,14 @@ private function categoryProductByCustomSortOrder(int $categoryId): array
231230
. ' AND cat_index.store_id = ' . $storeId,
232231
['cat_index.position']
233232
);
233+
234+
$productIds = [];
235+
foreach ($this->searchResult->getItems() as $item) {
236+
$productIds[] = $item->getId();
237+
}
238+
239+
$query->where('e.entity_id IN(?)', $productIds);
240+
234241
foreach ($sortOrders as $field => $dir) {
235242
if ($field === 'name') {
236243
$entityTypeId = $this->collection->getEntity()->getTypeId();
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
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="StoreFrontSearchWithProductAttributeOptionValue">
12+
<annotations>
13+
<stories value="Store front search product when display out of stock products to yes"/>
14+
<title value="Catalog shown entire catalog items count if show_of_stock_option enabled"/>
15+
<description value="Catalog shown entire catalog items count if show_of_stock_option enabled"/>
16+
<severity value="CRITICAL"/>
17+
<testCaseId value="AC-6395"/>
18+
<group value="catalog_search"/>
19+
</annotations>
20+
<before>
21+
<magentoCLI command="config:set cataloginventory/options/show_out_of_stock 1" stepKey="setOutOfStockToYes"/>
22+
<magentoCLI command="cache:clean config" stepKey="cacheClean"/>
23+
<actionGroup ref="AdminLoginActionGroup" stepKey="login"/>
24+
25+
<createData entity="_defaultCategory" stepKey="createCategory"/>
26+
<createData entity="SimpleProduct" stepKey="createProduct01">
27+
<requiredEntity createDataKey="createCategory"/>
28+
</createData>
29+
30+
<createData entity="productAttributeWithTwoOptions" stepKey="createConfigProductAttribute"/>
31+
<createData entity="productAttributeOption1" stepKey="createConfigProductAttributeOption1">
32+
<requiredEntity createDataKey="createConfigProductAttribute"/>
33+
</createData>
34+
<createData entity="productAttributeOption2" stepKey="createConfigProductAttributeOption2">
35+
<requiredEntity createDataKey="createConfigProductAttribute"/>
36+
</createData>
37+
<createData entity="AddToDefaultSet" stepKey="createConfigAddToAttributeSet">
38+
<requiredEntity createDataKey="createConfigProductAttribute"/>
39+
</createData>
40+
41+
<createData entity="SimpleProduct" stepKey="createProduct02">
42+
<requiredEntity createDataKey="createCategory"/>
43+
</createData>
44+
45+
<createData entity="AssignProductToCategory" stepKey="assignTestCategoryToTestProduct">
46+
<requiredEntity createDataKey="createCategory"/>
47+
<requiredEntity createDataKey="createProduct01"/>
48+
<requiredEntity createDataKey="createProduct02"/>
49+
</createData>
50+
</before>
51+
<after>
52+
<magentoCLI command="config:set cataloginventory/options/show_out_of_stock 0" stepKey="setOutOfStockToNo"/>
53+
<deleteData createDataKey="createConfigProductAttribute" stepKey="deleteConfigProductAttribute"/>
54+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
55+
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
56+
<deleteData createDataKey="createProduct01" stepKey="deleteProduct1"/>
57+
<deleteData createDataKey="createProduct02" stepKey="deleteProduct2"/>
58+
</after>
59+
60+
<amOnPage url="{{StorefrontCategoryPage.url($$createCategory.custom_attributes[url_key]$$)}}" stepKey="goToStorefrontCreatedCategoryPage"/>
61+
<click selector="{{StorefrontCategoryMainSection.productAttributeName('attribute')}}" stepKey="selectProductAttribute"/>
62+
<wait time="2" stepKey="waitForLoad"/>
63+
<click selector="{{StorefrontCategoryMainSection.productAttributeOptionValue('option')}}" stepKey="selectProductAttributeOptionValue"/>
64+
</test>
65+
</tests>

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
"colinmollenhour/cache-backend-file": "~1.4.1",
3838
"colinmollenhour/cache-backend-redis": "1.14.2",
3939
"colinmollenhour/credis": "1.13.0",
40-
"colinmollenhour/php-redis-session-abstract": "~1.4.5",
40+
"colinmollenhour/php-redis-session-abstract": "v1.5.0",
4141
"composer/composer": "^1.9 || ^2.0, !=2.2.16",
4242
"elasticsearch/elasticsearch": "~7.17.0",
4343
"ezyang/htmlpurifier": "^4.14",

composer.lock

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/internal/Magento/Framework/Composer/Test/Unit/ComposerInformationTest.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
use Composer\Package\CompletePackageInterface;
1212
use Composer\Package\Locker;
1313
use Composer\Package\RootPackageInterface;
14-
use Composer\Repository\RepositoryInterface;
14+
use Composer\Repository\LockArrayRepository;
1515
use Magento\Framework\Composer\ComposerInformation;
1616
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
1717
use PHPUnit\Framework\MockObject\Builder\InvocationMocker;
@@ -36,7 +36,7 @@ class ComposerInformationTest extends TestCase
3636
private $lockerMock;
3737

3838
/**
39-
* @var RepositoryInterface|InvocationMocker
39+
* @var LockArrayRepository|InvocationMocker
4040
*/
4141
private $lockerRepositoryMock;
4242

@@ -53,7 +53,10 @@ protected function setUp(): void
5353
$this->lockerMock = $this->getMockBuilder(Locker::class)
5454
->disableOriginalConstructor()
5555
->getMock();
56-
$this->lockerRepositoryMock = $this->getMockForAbstractClass(RepositoryInterface::class);
56+
$this->lockerRepositoryMock = $this->getMockBuilder(LockArrayRepository::class)
57+
->setMethods(['getLockedRepository','getPackages'])
58+
->disableOriginalConstructor()
59+
->getMock();
5760
$this->packageMock = $this->getMockForAbstractClass(CompletePackageInterface::class);
5861
$this->lockerMock->method('getLockedRepository')->willReturn($this->lockerRepositoryMock);
5962
$this->packageMock->method('getType')->willReturn('metapackage');

lib/internal/Magento/Framework/Composer/Test/Unit/DependencyCheckerTest.php

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,14 @@ class DependencyCheckerTest extends TestCase
2020
*/
2121
public function testCheckDependencies(): void
2222
{
23-
$composerApp =
24-
$this->createPartialMock(Application::class, ['setAutoExit', 'resetComposer', 'run']);
23+
$composerApp = $this->getMockBuilder(Application::class)
24+
->setMethods(['setAutoExit', 'resetComposer', 'run','__destruct'])
25+
->disableOriginalConstructor()
26+
->getMock();
2527
$directoryList = $this->createMock(DirectoryList::class);
2628
$directoryList->expects($this->exactly(2))->method('getRoot');
2729
$composerApp->expects($this->once())->method('setAutoExit')->with(false);
30+
$composerApp->expects($this->any())->method('__destruct');
2831

2932
$composerApp
3033
->method('run')
@@ -35,6 +38,7 @@ function ($input, $buffer) {
3538
'magento/project-community-edition requires magento/package-a (1.0)' . PHP_EOL .
3639
'magento/package-c requires magento/package-a (1.0)' . PHP_EOL;
3740
$buffer->writeln($output);
41+
return 1;
3842
}
3943
),
4044
$this->returnCallback(
@@ -43,6 +47,7 @@ function ($input, $buffer) {
4347
'magento/project-community-edition requires magento/package-a (1.0)' . PHP_EOL .
4448
'magento/package-d requires magento/package-b (1.0)' . PHP_EOL;
4549
$buffer->writeln($output);
50+
return 1;
4651
}
4752
)
4853
);
@@ -64,11 +69,14 @@ function ($input, $buffer) {
6469
*/
6570
public function testCheckDependenciesExcludeSelf(): void
6671
{
67-
$composerApp =
68-
$this->createPartialMock(Application::class, ['setAutoExit', 'resetComposer', 'run']);
72+
$composerApp = $this->getMockBuilder(Application::class)
73+
->setMethods(['setAutoExit', 'resetComposer', 'run','__destruct'])
74+
->disableOriginalConstructor()
75+
->getMock();
6976
$directoryList = $this->createMock(DirectoryList::class);
7077
$directoryList->expects($this->exactly(3))->method('getRoot');
7178
$composerApp->expects($this->once())->method('setAutoExit')->with(false);
79+
$composerApp->expects($this->any())->method('__destruct');
7280

7381
$composerApp
7482
->method('run')
@@ -79,6 +87,7 @@ function ($input, $buffer) {
7987
'magento/project-community-edition requires magento/package-a (1.0)' . PHP_EOL .
8088
'magento/package-c requires magento/package-a (1.0)' . PHP_EOL;
8189
$buffer->writeln($output);
90+
return 1;
8291
}
8392
),
8493
$this->returnCallback(
@@ -87,13 +96,15 @@ function ($input, $buffer) {
8796
'magento/project-community-edition requires magento/package-a (1.0)' . PHP_EOL .
8897
'magento/package-d requires magento/package-b (1.0)' . PHP_EOL;
8998
$buffer->writeln($output);
99+
return 1;
90100
}
91101
),
92102
$this->returnCallback(
93103
function ($input, $buffer) {
94104
$output = 'magento/package-d requires magento/package-c (1.0)' . PHP_EOL .
95105
'magento/project-community-edition requires magento/package-a (1.0)' . PHP_EOL;
96106
$buffer->writeln($output);
107+
return 1;
97108
}
98109
)
99110
);

lib/internal/Magento/Framework/Setup/Test/Unit/ListsTest.php

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,6 @@ class ListsTest extends TestCase
2424
*/
2525
private $mockConfig;
2626

27-
/**
28-
* @var array
29-
*/
30-
private $expectedTimezones = [
31-
'Australia/Darwin',
32-
'America/Los_Angeles',
33-
'Europe/Kiev',
34-
'Asia/Jerusalem',
35-
];
36-
3727
/**
3828
* @var array
3929
*/
@@ -56,6 +46,16 @@ class ListsTest extends TestCase
5646
'sr_Latn_RS' => 'Serbian (Latin, Serbia)'
5747
];
5848

49+
private function getExpectedTimezones($timeZone): array
50+
{
51+
return [
52+
'Australia/Darwin',
53+
'America/Los_Angeles',
54+
$timeZone,
55+
'Asia/Jerusalem',
56+
];
57+
}
58+
5959
protected function setUp(): void
6060
{
6161
$this->mockConfig = $this->getMockBuilder(ConfigInterface::class)
@@ -71,8 +71,11 @@ protected function setUp(): void
7171

7272
public function testGetTimezoneList()
7373
{
74-
$timezones = array_intersect($this->expectedTimezones, array_keys($this->lists->getTimezoneList()));
75-
$this->assertEquals($this->expectedTimezones, $timezones);
74+
$resultTimezone = array_keys($this->lists->getTimezoneList());
75+
$timeZone = in_array('Europe/Kyiv', $resultTimezone) ? 'Europe/Kyiv' : 'Europe/Kiev';
76+
$expectedTimezones = $this->getExpectedTimezones($timeZone);
77+
$timezones = array_intersect($expectedTimezones, $resultTimezone);
78+
$this->assertEquals($expectedTimezones, $timezones);
7679
}
7780

7881
public function testGetLocaleList()

lib/internal/Magento/Framework/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"ext-sodium": "*",
2424
"ext-xsl": "*",
2525
"lib-libxml": "*",
26-
"colinmollenhour/php-redis-session-abstract": "~1.4.5",
26+
"colinmollenhour/php-redis-session-abstract": "v1.5.0",
2727
"composer/composer": "^1.9 || ^2.0, !=2.2.16",
2828
"ezyang/htmlpurifier": "^4.14",
2929
"guzzlehttp/guzzle": "^7.4.2",

0 commit comments

Comments
 (0)