Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
ConfigurablePanelTest.php
Go to the documentation of this file.
1 <?php
7 
13 
14 class ConfigurablePanelTest extends \PHPUnit\Framework\TestCase
15 {
19  private $configurablePanelModifier;
20 
24  private $objectManagerHelper;
25 
29  private $productLocatorMock;
30 
34  private $urlBuilderMock;
35 
39  private $productMock;
40 
41  protected function setUp()
42  {
43  $this->productLocatorMock = $this->getMockBuilder(LocatorInterface::class)
44  ->getMockForAbstractClass();
45  $this->urlBuilderMock = $this->getMockBuilder(UrlInterface::class)
46  ->getMockForAbstractClass();
47  $this->productMock = $this->getMockBuilder(ProductInterface::class)
48  ->getMockForAbstractClass();
49 
50  $this->productLocatorMock->expects(static::any())
51  ->method('getProduct')
52  ->willReturn($this->productMock);
53  $this->urlBuilderMock->expects(static::any())
54  ->method('addSessionParam')
55  ->willReturnSelf();
56 
57  $this->objectManagerHelper = new ObjectManagerHelper($this);
58  $this->configurablePanelModifier = $this->objectManagerHelper->getObject(
59  ConfigurablePanelModifier::class,
60  [
61  'locator' => $this->productLocatorMock,
62  'urlBuilder' => $this->urlBuilderMock
63  ]
64  );
65  }
66 
67  public function testModifyMeta()
68  {
69  $result = $this->configurablePanelModifier->modifyMeta([]);
70 
71  $this->assertArrayHasKey(ConfigurablePanelModifier::GROUP_CONFIGURABLE, $result);
72  $this->assertArrayHasKey(ConfigurablePanelModifier::ASSOCIATED_PRODUCT_MODAL, $result);
73  }
74 }