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