@@ -56,6 +56,11 @@ class DataTest extends \PHPUnit\Framework\TestCase
56
56
/** @var SerializerInterface|\PHPUnit_Framework_MockObject_MockObject */
57
57
private $ serializerMock ;
58
58
59
+ /**
60
+ * @var \Magento\Framework\Escaper|\PHPUnit_Framework_MockObject_MockObject
61
+ */
62
+ private $ escaperMock ;
63
+
59
64
protected function setUp ()
60
65
{
61
66
$ objectManagerHelper = new \Magento \Framework \TestFramework \Unit \Helper \ObjectManager ($ this );
@@ -123,6 +128,13 @@ protected function prepareContext()
123
128
$ this ->contextMock ->expects ($ this ->any ())
124
129
->method ('getLayout ' )
125
130
->willReturn ($ this ->layoutMock );
131
+
132
+ $ this ->escaperMock = $ this ->createPartialMock (
133
+ \Magento \Framework \Escaper::class,
134
+ ['escapeHtml ' ]
135
+ );
136
+
137
+ $ this ->contextMock ->expects ($ this ->once ())->method ('getEscaper ' )->willReturn ($ this ->escaperMock );
126
138
}
127
139
128
140
protected function prepareCountryCollection ()
@@ -135,9 +147,11 @@ protected function prepareCountryCollection()
135
147
\Magento \Directory \Model \ResourceModel \Country \CollectionFactory::class
136
148
)
137
149
->disableOriginalConstructor ()
138
- ->setMethods ([
139
- 'create '
140
- ])
150
+ ->setMethods (
151
+ [
152
+ 'create '
153
+ ]
154
+ )
141
155
->getMock ();
142
156
143
157
$ this ->countryCollectionFactoryMock ->expects ($ this ->any ())
@@ -285,17 +299,21 @@ protected function mockElementHtmlSelect($defaultCountry, $options, $resultHtml)
285
299
286
300
$ elementHtmlSelect = $ this ->getMockBuilder (\Magento \Framework \View \Element \Html \Select::class)
287
301
->disableOriginalConstructor ()
288
- ->setMethods ([
289
- 'setName ' ,
290
- 'setId ' ,
291
- 'setTitle ' ,
292
- 'setValue ' ,
293
- 'setOptions ' ,
294
- 'setExtraParams ' ,
295
- 'getHtml ' ,
296
- ])
302
+ ->setMethods (
303
+ [
304
+ 'setName ' ,
305
+ 'setId ' ,
306
+ 'setTitle ' ,
307
+ 'setValue ' ,
308
+ 'setOptions ' ,
309
+ 'setExtraParams ' ,
310
+ 'getHtml ' ,
311
+ ]
312
+ )
297
313
->getMock ();
298
314
315
+ $ this ->escaperMock ->expects ($ this ->once ())->method ('escapeHtml ' )->with (__ ($ title ))->willReturn ($ title );
316
+
299
317
$ elementHtmlSelect ->expects ($ this ->once ())
300
318
->method ('setName ' )
301
319
->with ($ name )
0 commit comments