Skip to content

Commit ab29fc0

Browse files
committed
ACP2E-1499: Attributes weight didn't work in search keyword
- modify test
1 parent bff4a69 commit ab29fc0

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

app/code/Magento/CatalogSearch/Test/Unit/Model/Search/Request/PartialSearchModifierTest.php

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,16 @@ protected function setUp(): void
5555
public function testModify(array $attributes, array $requests, array $expected): void
5656
{
5757
$items = [];
58+
$searchWeight = 10;
5859
foreach ($attributes as $attribute) {
59-
$item = $this->getMockForAbstractClass(\Magento\Eav\Api\Data\AttributeInterface::class);
60+
$item = $this->getMockBuilder(\Magento\Catalog\Model\ResourceModel\Eav\Attribute::class)
61+
->setMethods(['getAttributeCode', 'getSearchWeight'])
62+
->disableOriginalConstructor()
63+
->getMock();
6064
$item->method('getAttributeCode')
6165
->willReturn($attribute);
66+
$item->method('getSearchWeight')
67+
->willReturn($searchWeight);
6268
$items[] = $item;
6369
}
6470
$reflectionProperty = new \ReflectionProperty($this->collection, '_items');
@@ -76,6 +82,7 @@ public function modifyDataProvider(): array
7682
[
7783
[
7884
'name',
85+
'sku',
7986
],
8087
[
8188
'search_1' => [
@@ -133,9 +140,15 @@ public function modifyDataProvider(): array
133140
[
134141
'field' => '*'
135142
],
143+
[
144+
'field' => 'sku',
145+
'matchCondition' => 'match_phrase_prefix',
146+
'boost' => 10
147+
],
136148
[
137149
'field' => 'name',
138150
'matchCondition' => 'match_phrase_prefix',
151+
'boost' => 10
139152
],
140153
]
141154
]

0 commit comments

Comments
 (0)