9
9
10
10
use Magento \Customer \Block \Address \Renderer \RendererInterface as CustomerAddressBlockRenderer ;
11
11
use Magento \Customer \Model \Address \Config as CustomerAddressConfig ;
12
+ use Magento \Framework \App \Config \ScopeConfigInterface ;
12
13
use Magento \Framework \DataObject ;
13
14
use Magento \Framework \Event \ManagerInterface as EventManager ;
14
15
use Magento \Framework \TestFramework \Unit \Helper \ObjectManager as ObjectManagerHelper ;
18
19
use PHPUnit \Framework \MockObject \MockObject ;
19
20
use PHPUnit \Framework \TestCase ;
20
21
22
+ /**
23
+ * Test for \Magento\Sales\Model\Order\Address\Renderer.
24
+ */
21
25
class RendererTest extends TestCase
22
26
{
23
27
/**
@@ -55,6 +59,14 @@ class RendererTest extends TestCase
55
59
*/
56
60
private $ customerAddressBlockRendererMock ;
57
61
62
+ /**
63
+ * @var ScopeConfigInterface|MockObject
64
+ */
65
+ private $ storeConfigMock ;
66
+
67
+ /**
68
+ * @ingeritdoc
69
+ */
58
70
protected function setUp (): void
59
71
{
60
72
$ this ->customerAddressConfigMock = $ this ->getMockBuilder (CustomerAddressConfig::class)
@@ -75,12 +87,15 @@ protected function setUp(): void
75
87
->method ('getOrder ' )
76
88
->willReturn ($ this ->orderMock );
77
89
90
+ $ this ->storeConfigMock = $ this ->createMock (ScopeConfigInterface::class);
91
+
78
92
$ this ->objectManagerHelper = new ObjectManagerHelper ($ this );
79
93
$ this ->orderAddressRenderer = $ this ->objectManagerHelper ->getObject (
80
94
OrderAddressRenderer::class,
81
95
[
82
96
'addressConfig ' => $ this ->customerAddressConfigMock ,
83
- 'eventManager ' => $ this ->eventManagerMock
97
+ 'eventManager ' => $ this ->eventManagerMock ,
98
+ 'scopeConfig ' => $ this ->storeConfigMock
84
99
]
85
100
);
86
101
}
@@ -89,7 +104,7 @@ public function testFormat()
89
104
{
90
105
$ type = 'html ' ;
91
106
$ formatType = new DataObject (['renderer ' => $ this ->customerAddressBlockRendererMock ]);
92
- $ addressData = ['address ' , 'data ' ];
107
+ $ addressData = ['address ' , 'data ' , ' locale ' => 1 ];
93
108
$ result = 'result string ' ;
94
109
95
110
$ this ->setStoreExpectations (1 );
@@ -103,6 +118,9 @@ public function testFormat()
103
118
$ this ->orderAddressMock ->expects (static ::atLeastOnce ())
104
119
->method ('getData ' )
105
120
->willReturn ($ addressData );
121
+ $ this ->storeConfigMock ->expects ($ this ->once ())
122
+ ->method ('getValue ' )
123
+ ->willReturn (1 );
106
124
$ this ->customerAddressBlockRendererMock ->expects (static ::once ())
107
125
->method ('renderArray ' )
108
126
->with ($ addressData , null )
0 commit comments