ConfigTest.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Sales\Test\Unit\Model\Order\Pdf;
  7. class ConfigTest extends \PHPUnit\Framework\TestCase
  8. {
  9. /**
  10. * @var \Magento\Sales\Model\Order\Pdf\Config
  11. */
  12. protected $_model;
  13. /**
  14. * @var \Magento\Framework\Config\Data|\PHPUnit_Framework_MockObject_MockObject
  15. */
  16. protected $_dataStorage;
  17. protected function setUp()
  18. {
  19. $this->_dataStorage = $this->createMock(\Magento\Framework\Config\Data::class);
  20. $this->_model = new \Magento\Sales\Model\Order\Pdf\Config($this->_dataStorage);
  21. }
  22. public function testGetRenderersPerProduct()
  23. {
  24. $configuration = ['product_type_one' => 'Renderer_One', 'product_type_two' => 'Renderer_Two'];
  25. $this->_dataStorage->expects(
  26. $this->once()
  27. )->method(
  28. 'get'
  29. )->with(
  30. "renderers/page_type",
  31. []
  32. )->will(
  33. $this->returnValue($configuration)
  34. );
  35. $this->assertSame($configuration, $this->_model->getRenderersPerProduct('page_type'));
  36. }
  37. public function testGetTotals()
  38. {
  39. $configuration = ['total1' => ['title' => 'Title1'], 'total2' => ['title' => 'Title2']];
  40. $this->_dataStorage->expects(
  41. $this->once()
  42. )->method(
  43. 'get'
  44. )->with(
  45. 'totals',
  46. []
  47. )->will(
  48. $this->returnValue($configuration)
  49. );
  50. $this->assertSame($configuration, $this->_model->getTotals());
  51. }
  52. }