Skip to content

Commit c2d9da8

Browse files
author
Oleksii Korshenko
authored
Merge pull request #1408 from magento-engcom/develop-prs
Public Pull Requests #10484 #10475
2 parents 8bbddb0 + 67318e7 commit c2d9da8

File tree

5 files changed

+16
-10
lines changed

5 files changed

+16
-10
lines changed

app/code/Magento/Customer/Model/Customer/Source/Group.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public function toOptionArray()
5656
$customerGroups = [];
5757
$customerGroups[] = [
5858
'label' => __('ALL GROUPS'),
59-
'value' => GroupInterface::CUST_GROUP_ALL,
59+
'value' => (string)GroupInterface::CUST_GROUP_ALL,
6060
];
6161

6262
/** @var GroupSearchResultsInterface $groups */

app/code/Magento/Customer/Test/Unit/Model/Customer/Source/GroupTest.php

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ protected function setUp()
7171
public function testToOptionArray()
7272
{
7373
$customerGroups = [
74-
['label' => __('ALL GROUPS'), 'value' => 32000],
75-
['label' => __('NOT LOGGED IN'), 'value' => 0]
74+
['label' => __('ALL GROUPS'), 'value' => '32000'],
75+
['label' => __('NOT LOGGED IN'), 'value' => '0'],
7676
];
7777

7878
$this->moduleManagerMock->expects($this->any())
@@ -95,11 +95,17 @@ public function testToOptionArray()
9595
->setMethods(['getCode', 'getId'])
9696
->getMockForAbstractClass();
9797
$groupTest->expects($this->any())->method('getCode')->willReturn(__('NOT LOGGED IN'));
98-
$groupTest->expects($this->any())->method('getId')->willReturn(0);
98+
$groupTest->expects($this->any())->method('getId')->willReturn('0');
9999
$groups = [$groupTest];
100100

101101
$this->searchResultMock->expects($this->any())->method('getItems')->willReturn($groups);
102102

103-
$this->assertEquals($customerGroups, $this->model->toOptionArray());
103+
$actualCustomerGroups = $this->model->toOptionArray();
104+
105+
$this->assertEquals($customerGroups, $actualCustomerGroups);
106+
107+
foreach ($actualCustomerGroups as $actualCustomerGroup) {
108+
$this->assertInternalType('string', $actualCustomerGroup['value']);
109+
}
104110
}
105111
}

app/code/Magento/Search/Block/Term.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,8 @@ protected function _loadTerms()
9494
continue;
9595
}
9696
$term->setRatio(($term->getPopularity() - $this->_minPopularity) / $range);
97-
$temp[$term->getName()] = $term;
98-
$termKeys[] = $term->getName();
97+
$temp[$term->getQueryText()] = $term;
98+
$termKeys[] = $term->getQueryText();
9999
}
100100
natcasesort($termKeys);
101101

@@ -127,7 +127,7 @@ public function getSearchUrl($obj)
127127
* url encoding will be done in Url.php http_build_query
128128
* so no need to explicitly called urlencode for the text
129129
*/
130-
$url->setQueryParam('q', $obj->getName());
130+
$url->setQueryParam('q', $obj->getQueryText());
131131
return $url->getUrl('catalogsearch/result');
132132
}
133133

app/code/Magento/Search/view/frontend/templates/term.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<li class="item">
1414
<a href="<?= /* @escapeNotVerified */ $block->getSearchUrl($_term) ?>"
1515
style="font-size:<?= /* @escapeNotVerified */ $_term->getRatio()*70+75 ?>%;">
16-
<?= $block->escapeHtml($_term->getName()) ?>
16+
<?= $block->escapeHtml($_term->getQueryText()) ?>
1717
</a>
1818
</li>
1919
<?php endforeach; ?>

dev/tests/integration/testsuite/Magento/CatalogSearch/Block/TermTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ protected function setUp()
2424
public function testGetSearchUrl()
2525
{
2626
$query = uniqid();
27-
$obj = new \Magento\Framework\DataObject(['name' => $query]);
27+
$obj = new \Magento\Framework\DataObject(['query_text' => $query]);
2828
$this->assertStringEndsWith("/catalogsearch/result/?q={$query}", $this->_block->getSearchUrl($obj));
2929
}
3030
}

0 commit comments

Comments
 (0)