Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
EsConfigTest.php
Go to the documentation of this file.
1 <?php
7 
11 
15 class EsConfigTest extends \PHPUnit\Framework\TestCase
16 {
20  private $objectManager;
21 
25  protected $config;
26 
30  protected $reader;
31 
35  protected $cache;
36 
40  private $serializerMock;
41 
45  protected function setUp()
46  {
47  $this->objectManager = new ObjectManagerHelper($this);
48  $this->reader = $this->getMockBuilder(\Magento\Framework\Config\ReaderInterface::class)
49  ->disableOriginalConstructor()
50  ->getMock();
51 
52  $this->cache = $this->getMockBuilder(\Magento\Framework\Config\CacheInterface::class)
53  ->disableOriginalConstructor()
54  ->getMock();
55 
56  $this->cache->expects($this->any())
57  ->method('load')
58  ->willReturn('serializedData');
59 
60  $this->serializerMock = $this->createMock(\Magento\Framework\Serialize\SerializerInterface::class);
61 
62  $this->serializerMock->expects($this->once())
63  ->method('unserialize')
64  ->with('serializedData')
65  ->willReturn(['unserializedData']);
66 
67  $this->config = $this->objectManager->getObject(
68  \Magento\Elasticsearch\Model\Adapter\Index\Config\EsConfig::class,
69  [
70  'reader' => $this->reader,
71  'cache' => $this->cache,
72  'serializer' => $this->serializerMock,
73  ]
74  );
75  }
76 
80  public function testGetStemmerInfo()
81  {
82  $this->config->getStemmerInfo();
83  }
84 
88  public function testGetStopwordsInfo()
89  {
90  $this->config->getStopwordsInfo();
91  }
92 }