Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
SectionConfigTest.php
Go to the documentation of this file.
1 <?php
7 
9 
10 class SectionConfigTest extends \PHPUnit\Framework\TestCase
11 {
13  protected $block;
14 
17 
19  protected $context;
20 
22  protected $sectionConfig;
23 
25  protected $encoder;
26 
27  protected function setUp()
28  {
29  $this->context = $this->createMock(\Magento\Framework\View\Element\Template\Context::class);
30  $this->sectionConfig = $this->createMock(\Magento\Framework\Config\DataInterface::class);
31  $this->encoder = $this->createMock(\Magento\Framework\Json\EncoderInterface::class);
32 
33  $this->objectManagerHelper = new ObjectManagerHelper($this);
34  $this->block = $this->objectManagerHelper->getObject(
35  \Magento\Customer\Block\SectionConfig::class,
36  [
37  'context' => $this->context,
38  'sectionConfig' => $this->sectionConfig
39  ]
40  );
41  }
42 
43  public function testGetSections()
44  {
45  $this->sectionConfig->expects($this->once())->method('get')->with('sections')->willReturn(['data']);
46 
47  $this->assertEquals(['data'], $this->block->getSections());
48  }
49 }