6 declare(strict_types=1);
20 private $synonymAnalyzer;
25 private $synReaderModel;
34 $this->synReaderModel = $this->getMockBuilder(\
Magento\Search\Model\SynonymReader::class)
35 ->disableOriginalConstructor()
38 $this->synonymAnalyzer =
$helper->getObject(
39 \
Magento\Search\Model\SynonymAnalyzer::class,
41 'synReader' => $this->synReaderModel,
51 $phrase =
'Elizabeth is the british queen';
53 0 => [ 0 =>
"Elizabeth" ],
56 3 => [ 0 =>
"british", 1 =>
"english" ],
57 4 => [ 0 =>
"queen", 1 =>
"monarch" ],
59 $this->synReaderModel->expects($this->once())
60 ->method(
'loadByPhrase')
64 $this->synReaderModel->expects($this->once())
67 [
'synonyms' =>
'british,english'],
68 [
'synonyms' =>
'queen,monarch'],
72 $actual = $this->synonymAnalyzer->getSynonymsForPhrase($phrase);
73 $this->assertEquals($expected, $actual);
85 $actual = $this->synonymAnalyzer->getSynonymsForPhrase($phrase);
86 $this->assertEquals($expected, $actual);
testGetSynonymsForPhraseEmptyPhrase()
testGetSynonymsForPhrase()