Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
ConfigTest.php
Go to the documentation of this file.
1 <?php
7 
8 class ConfigTest extends \PHPUnit\Framework\TestCase
9 {
13  protected $model;
14 
18  protected $configMock;
19 
23  protected function setUp()
24  {
25  $this->configMock = $this->createMock(\Magento\Indexer\Model\Config\Data::class);
26 
27  $this->model = new \Magento\Indexer\Model\Config(
28  $this->configMock
29  );
30  }
31 
32  public function testGetIndexers()
33  {
34  $this->configMock->expects($this->once())->method('get')->with()->willReturnSelf();
35  $this->model->getIndexers();
36  }
37 
38  public function testGetIndexer()
39  {
40  $indexerId = 1;
41  $this->configMock->expects($this->once())->method('get')->with($indexerId)->willReturnSelf();
42  $this->model->getIndexer($indexerId);
43  }
44 
45  public function testGetNotExistingIndexer()
46  {
47  $indexerId = 1;
48  $this->configMock
49  ->expects($this->once())
50  ->method('get')
51  ->with($indexerId);
52  $this->assertEquals([], $this->model->getIndexer($indexerId));
53  }
54 }