Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions | Static Public Member Functions | Protected Member Functions
SynonymReaderTest Class Reference
Inheritance diagram for SynonymReaderTest:

Public Member Functions

 testLoadByPhrase ($phrase, $expectedResult)
 

Static Public Member Functions

static loadByPhraseDataProvider ()
 

Protected Member Functions

 setUp ()
 

Detailed Description

@magentoDbIsolation disabled @magentoDataFixture Magento/Search/_files/synonym_reader.php

Definition at line 12 of file SynonymReaderTest.php.

Member Function Documentation

◆ loadByPhraseDataProvider()

static loadByPhraseDataProvider ( )
static
Returns
array

Definition at line 28 of file SynonymReaderTest.php.

29  {
30  return [
31  [
32  'ELIZABETH', []
33  ],
34  [
35  'ENGLISH', [['synonyms' => 'british,english', 'store_id' => 1, 'website_id' => 0]]
36  ],
37  [
38  'English', [['synonyms' => 'british,english', 'store_id' => 1, 'website_id' => 0]]
39  ],
40  [
41  'QUEEN', [['synonyms' => 'queen,monarch', 'store_id' => 1, 'website_id' => 0]]
42  ],
43  [
44  'Monarch', [['synonyms' => 'queen,monarch', 'store_id' => 1, 'website_id' => 0]]
45  ],
46  [
47  'MONARCH English', [
48  ['synonyms' => 'queen,monarch', 'store_id' => 1, 'website_id' => 0],
49  ['synonyms' => 'british,english', 'store_id' => 1, 'website_id' => 0]
50  ]
51  ]
52  ];
53  }

◆ setUp()

setUp ( )
protected

Definition at line 19 of file SynonymReaderTest.php.

20  {
22  $this->model = $objectManager->get(\Magento\Search\Model\SynonymReader::class);
23  }
$objectManager
Definition: bootstrap.php:17

◆ testLoadByPhrase()

testLoadByPhrase (   $phrase,
  $expectedResult 
)
Parameters
string$phrase
array$expectedResult@dataProvider loadByPhraseDataProvider

Definition at line 60 of file SynonymReaderTest.php.

61  {
62  $data = $this->model->loadByPhrase($phrase)->getData();
63 
64  $i = 0;
65  foreach ($expectedResult as $r) {
66  $this->assertEquals($r['synonyms'], $data[$i]['synonyms']);
67  $this->assertEquals($r['store_id'], $data[$i]['store_id']);
68  $this->assertEquals($r['website_id'], $data[$i]['website_id']);
69  ++$i;
70  }
71  }
$i
Definition: gallery.phtml:31

The documentation for this class was generated from the following file: