ConfigPluginTest.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Captcha\Test\Unit\Model\Cart;
  7. class ConfigPluginTest extends \PHPUnit\Framework\TestCase
  8. {
  9. /**
  10. * @var \Magento\Captcha\Model\Cart\ConfigPlugin
  11. */
  12. protected $model;
  13. /**
  14. * @var \PHPUnit_Framework_MockObject_MockObject
  15. */
  16. protected $configProviderMock;
  17. protected function setUp()
  18. {
  19. $this->configProviderMock = $this->createMock(\Magento\Captcha\Model\Checkout\ConfigProvider::class);
  20. $this->model = new \Magento\Captcha\Model\Cart\ConfigPlugin(
  21. $this->configProviderMock
  22. );
  23. }
  24. public function testAfterGetConfig()
  25. {
  26. $resultMock = [
  27. 'result' => [
  28. 'data' => 'resultDataMock'
  29. ]
  30. ];
  31. $configMock = [
  32. 'config' => [
  33. 'data' => 'configDataMock'
  34. ]
  35. ];
  36. $expectedResult = array_merge_recursive($resultMock, $configMock);
  37. $sidebarMock = $this->createMock(\Magento\Checkout\Block\Cart\Sidebar::class);
  38. $this->configProviderMock->expects($this->once())->method('getConfig')->willReturn($configMock);
  39. $this->assertEquals($expectedResult, $this->model->afterGetConfig($sidebarMock, $resultMock));
  40. }
  41. }