Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
ConfigPluginTest.php
Go to the documentation of this file.
1 <?php
7 
8 class ConfigPluginTest extends \PHPUnit\Framework\TestCase
9 {
13  protected $model;
14 
19 
20  protected function setUp()
21  {
22  $this->configProviderMock = $this->createMock(\Magento\Captcha\Model\Checkout\ConfigProvider::class);
23  $this->model = new \Magento\Captcha\Model\Cart\ConfigPlugin(
24  $this->configProviderMock
25  );
26  }
27 
28  public function testAfterGetConfig()
29  {
30  $resultMock = [
31  'result' => [
32  'data' => 'resultDataMock'
33  ]
34  ];
35  $configMock = [
36  'config' => [
37  'data' => 'configDataMock'
38  ]
39  ];
40  $expectedResult = array_merge_recursive($resultMock, $configMock);
41  $sidebarMock = $this->createMock(\Magento\Checkout\Block\Cart\Sidebar::class);
42  $this->configProviderMock->expects($this->once())->method('getConfig')->willReturn($configMock);
43 
44  $this->assertEquals($expectedResult, $this->model->afterGetConfig($sidebarMock, $resultMock));
45  }
46 }