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 $_storage;
14 
18  protected $_model;
19 
20  protected function setUp()
21  {
22  $this->_storage = $this->createPartialMock(\Magento\Framework\Cache\Config\Data::class, ['get']);
23  $this->_model = new \Magento\Framework\Cache\Config($this->_storage);
24  }
25 
26  public function testGetTypes()
27  {
28  $this->_storage->expects(
29  $this->once()
30  )->method(
31  'get'
32  )->with(
33  'types',
34  []
35  )->will(
36  $this->returnValue(['val1', 'val2'])
37  );
38  $result = $this->_model->getTypes();
39  $this->assertCount(2, $result);
40  }
41 
42  public function testGetType()
43  {
44  $this->_storage->expects(
45  $this->once()
46  )->method(
47  'get'
48  )->with(
49  'types/someType',
50  []
51  )->will(
52  $this->returnValue(['someTypeValue'])
53  );
54  $result = $this->_model->getType('someType');
55  $this->assertCount(1, $result);
56  }
57 }