SectionConfigTest.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Customer\Test\Unit\Block;
  7. use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper;
  8. class SectionConfigTest extends \PHPUnit\Framework\TestCase
  9. {
  10. /** @var \Magento\Customer\Block\block */
  11. protected $block;
  12. /** @var ObjectManagerHelper */
  13. protected $objectManagerHelper;
  14. /** @var \Magento\Framework\View\Element\Template\Context|\PHPUnit_Framework_MockObject_MockObject */
  15. protected $context;
  16. /** @var \Magento\Framework\Config\DataInterface|\PHPUnit_Framework_MockObject_MockObject */
  17. protected $sectionConfig;
  18. /** @var \Magento\Framework\Json\EncoderInterface|\PHPUnit_Framework_MockObject_MockObject */
  19. protected $encoder;
  20. protected function setUp()
  21. {
  22. $this->context = $this->createMock(\Magento\Framework\View\Element\Template\Context::class);
  23. $this->sectionConfig = $this->createMock(\Magento\Framework\Config\DataInterface::class);
  24. $this->encoder = $this->createMock(\Magento\Framework\Json\EncoderInterface::class);
  25. $this->objectManagerHelper = new ObjectManagerHelper($this);
  26. $this->block = $this->objectManagerHelper->getObject(
  27. \Magento\Customer\Block\SectionConfig::class,
  28. [
  29. 'context' => $this->context,
  30. 'sectionConfig' => $this->sectionConfig
  31. ]
  32. );
  33. }
  34. public function testGetSections()
  35. {
  36. $this->sectionConfig->expects($this->once())->method('get')->with('sections')->willReturn(['data']);
  37. $this->assertEquals(['data'], $this->block->getSections());
  38. }
  39. }