1414use PHPUnit \Framework \MockObject \MockObject ;
1515use PHPUnit \Framework \TestCase ;
1616use Symfony \Component \Form \ChoiceList \ArrayChoiceList ;
17+ use Symfony \Component \Form \ChoiceList \ChoiceListInterface ;
1718use Symfony \Component \Form \ChoiceList \Factory \CachingFactoryDecorator ;
19+ use Symfony \Component \Form \ChoiceList \Factory \ChoiceListFactoryInterface ;
20+ use Symfony \Component \Form \ChoiceList \Loader \ChoiceLoaderInterface ;
1821use Symfony \Component \Form \ChoiceList \View \ChoiceListView ;
1922
2023/**
@@ -34,7 +37,7 @@ class CachingFactoryDecoratorTest extends TestCase
3437
3538 protected function setUp (): void
3639 {
37- $ this ->decoratedFactory = $ this ->getMockBuilder (\ Symfony \ Component \ Form \ ChoiceList \ Factory \ ChoiceListFactoryInterface::class)-> getMock ( );
40+ $ this ->decoratedFactory = $ this ->createMock ( ChoiceListFactoryInterface::class);
3841 $ this ->factory = new CachingFactoryDecorator ($ this ->decoratedFactory );
3942 }
4043
@@ -163,7 +166,7 @@ public function testCreateFromChoicesDifferentValueClosure()
163166
164167 public function testCreateFromLoaderSameLoader ()
165168 {
166- $ loader = $ this ->getMockBuilder (\ Symfony \ Component \ Form \ ChoiceList \ Loader \ ChoiceLoaderInterface::class)-> getMock ( );
169+ $ loader = $ this ->createMock ( ChoiceLoaderInterface::class);
167170 $ list = new ArrayChoiceList ([]);
168171
169172 $ this ->decoratedFactory ->expects ($ this ->once ())
@@ -177,8 +180,8 @@ public function testCreateFromLoaderSameLoader()
177180
178181 public function testCreateFromLoaderDifferentLoader ()
179182 {
180- $ loader1 = $ this ->getMockBuilder (\ Symfony \ Component \ Form \ ChoiceList \ Loader \ ChoiceLoaderInterface::class)-> getMock ( );
181- $ loader2 = $ this ->getMockBuilder (\ Symfony \ Component \ Form \ ChoiceList \ Loader \ ChoiceLoaderInterface::class)-> getMock ( );
183+ $ loader1 = $ this ->createMock ( ChoiceLoaderInterface::class);
184+ $ loader2 = $ this ->createMock ( ChoiceLoaderInterface::class);
182185 $ list1 = new ArrayChoiceList ([]);
183186 $ list2 = new ArrayChoiceList ([]);
184187
@@ -196,7 +199,7 @@ public function testCreateFromLoaderDifferentLoader()
196199
197200 public function testCreateFromLoaderSameValueClosure ()
198201 {
199- $ loader = $ this ->getMockBuilder (\ Symfony \ Component \ Form \ ChoiceList \ Loader \ ChoiceLoaderInterface::class)-> getMock ( );
202+ $ loader = $ this ->createMock ( ChoiceLoaderInterface::class);
200203 $ list = new ArrayChoiceList ([]);
201204 $ closure = function () {};
202205
@@ -211,7 +214,7 @@ public function testCreateFromLoaderSameValueClosure()
211214
212215 public function testCreateFromLoaderDifferentValueClosure ()
213216 {
214- $ loader = $ this ->getMockBuilder (\ Symfony \ Component \ Form \ ChoiceList \ Loader \ ChoiceLoaderInterface::class)-> getMock ( );
217+ $ loader = $ this ->createMock ( ChoiceLoaderInterface::class);
215218 $ list1 = new ArrayChoiceList ([]);
216219 $ list2 = new ArrayChoiceList ([]);
217220 $ closure1 = function () {};
@@ -232,7 +235,7 @@ public function testCreateFromLoaderDifferentValueClosure()
232235 public function testCreateViewSamePreferredChoices ()
233236 {
234237 $ preferred = ['a ' ];
235- $ list = $ this ->getMockBuilder (\ Symfony \ Component \ Form \ ChoiceList \ ChoiceListInterface::class)-> getMock ( );
238+ $ list = $ this ->createMock ( ChoiceListInterface::class);
236239 $ view = new ChoiceListView ();
237240
238241 $ this ->decoratedFactory ->expects ($ this ->once ())
@@ -248,7 +251,7 @@ public function testCreateViewDifferentPreferredChoices()
248251 {
249252 $ preferred1 = ['a ' ];
250253 $ preferred2 = ['b ' ];
251- $ list = $ this ->getMockBuilder (\ Symfony \ Component \ Form \ ChoiceList \ ChoiceListInterface::class)-> getMock ( );
254+ $ list = $ this ->createMock ( ChoiceListInterface::class);
252255 $ view1 = new ChoiceListView ();
253256 $ view2 = new ChoiceListView ();
254257
@@ -267,7 +270,7 @@ public function testCreateViewDifferentPreferredChoices()
267270 public function testCreateViewSamePreferredChoicesClosure ()
268271 {
269272 $ preferred = function () {};
270- $ list = $ this ->getMockBuilder (\ Symfony \ Component \ Form \ ChoiceList \ ChoiceListInterface::class)-> getMock ( );
273+ $ list = $ this ->createMock ( ChoiceListInterface::class);
271274 $ view = new ChoiceListView ();
272275
273276 $ this ->decoratedFactory ->expects ($ this ->once ())
@@ -283,7 +286,7 @@ public function testCreateViewDifferentPreferredChoicesClosure()
283286 {
284287 $ preferred1 = function () {};
285288 $ preferred2 = function () {};
286- $ list = $ this ->getMockBuilder (\ Symfony \ Component \ Form \ ChoiceList \ ChoiceListInterface::class)-> getMock ( );
289+ $ list = $ this ->createMock ( ChoiceListInterface::class);
287290 $ view1 = new ChoiceListView ();
288291 $ view2 = new ChoiceListView ();
289292
@@ -302,7 +305,7 @@ public function testCreateViewDifferentPreferredChoicesClosure()
302305 public function testCreateViewSameLabelClosure ()
303306 {
304307 $ labels = function () {};
305- $ list = $ this ->getMockBuilder (\ Symfony \ Component \ Form \ ChoiceList \ ChoiceListInterface::class)-> getMock ( );
308+ $ list = $ this ->createMock ( ChoiceListInterface::class);
306309 $ view = new ChoiceListView ();
307310
308311 $ this ->decoratedFactory ->expects ($ this ->once ())
@@ -318,7 +321,7 @@ public function testCreateViewDifferentLabelClosure()
318321 {
319322 $ labels1 = function () {};
320323 $ labels2 = function () {};
321- $ list = $ this ->getMockBuilder (\ Symfony \ Component \ Form \ ChoiceList \ ChoiceListInterface::class)-> getMock ( );
324+ $ list = $ this ->createMock ( ChoiceListInterface::class);
322325 $ view1 = new ChoiceListView ();
323326 $ view2 = new ChoiceListView ();
324327
@@ -337,7 +340,7 @@ public function testCreateViewDifferentLabelClosure()
337340 public function testCreateViewSameIndexClosure ()
338341 {
339342 $ index = function () {};
340- $ list = $ this ->getMockBuilder (\ Symfony \ Component \ Form \ ChoiceList \ ChoiceListInterface::class)-> getMock ( );
343+ $ list = $ this ->createMock ( ChoiceListInterface::class);
341344 $ view = new ChoiceListView ();
342345
343346 $ this ->decoratedFactory ->expects ($ this ->once ())
@@ -353,7 +356,7 @@ public function testCreateViewDifferentIndexClosure()
353356 {
354357 $ index1 = function () {};
355358 $ index2 = function () {};
356- $ list = $ this ->getMockBuilder (\ Symfony \ Component \ Form \ ChoiceList \ ChoiceListInterface::class)-> getMock ( );
359+ $ list = $ this ->createMock ( ChoiceListInterface::class);
357360 $ view1 = new ChoiceListView ();
358361 $ view2 = new ChoiceListView ();
359362
@@ -372,7 +375,7 @@ public function testCreateViewDifferentIndexClosure()
372375 public function testCreateViewSameGroupByClosure ()
373376 {
374377 $ groupBy = function () {};
375- $ list = $ this ->getMockBuilder (\ Symfony \ Component \ Form \ ChoiceList \ ChoiceListInterface::class)-> getMock ( );
378+ $ list = $ this ->createMock ( ChoiceListInterface::class);
376379 $ view = new ChoiceListView ();
377380
378381 $ this ->decoratedFactory ->expects ($ this ->once ())
@@ -388,7 +391,7 @@ public function testCreateViewDifferentGroupByClosure()
388391 {
389392 $ groupBy1 = function () {};
390393 $ groupBy2 = function () {};
391- $ list = $ this ->getMockBuilder (\ Symfony \ Component \ Form \ ChoiceList \ ChoiceListInterface::class)-> getMock ( );
394+ $ list = $ this ->createMock ( ChoiceListInterface::class);
392395 $ view1 = new ChoiceListView ();
393396 $ view2 = new ChoiceListView ();
394397
@@ -407,7 +410,7 @@ public function testCreateViewDifferentGroupByClosure()
407410 public function testCreateViewSameAttributes ()
408411 {
409412 $ attr = ['class ' => 'foobar ' ];
410- $ list = $ this ->getMockBuilder (\ Symfony \ Component \ Form \ ChoiceList \ ChoiceListInterface::class)-> getMock ( );
413+ $ list = $ this ->createMock ( ChoiceListInterface::class);
411414 $ view = new ChoiceListView ();
412415
413416 $ this ->decoratedFactory ->expects ($ this ->once ())
@@ -423,7 +426,7 @@ public function testCreateViewDifferentAttributes()
423426 {
424427 $ attr1 = ['class ' => 'foobar1 ' ];
425428 $ attr2 = ['class ' => 'foobar2 ' ];
426- $ list = $ this ->getMockBuilder (\ Symfony \ Component \ Form \ ChoiceList \ ChoiceListInterface::class)-> getMock ( );
429+ $ list = $ this ->createMock ( ChoiceListInterface::class);
427430 $ view1 = new ChoiceListView ();
428431 $ view2 = new ChoiceListView ();
429432
@@ -442,7 +445,7 @@ public function testCreateViewDifferentAttributes()
442445 public function testCreateViewSameAttributesClosure ()
443446 {
444447 $ attr = function () {};
445- $ list = $ this ->getMockBuilder (\ Symfony \ Component \ Form \ ChoiceList \ ChoiceListInterface::class)-> getMock ( );
448+ $ list = $ this ->createMock ( ChoiceListInterface::class);
446449 $ view = new ChoiceListView ();
447450
448451 $ this ->decoratedFactory ->expects ($ this ->once ())
@@ -458,7 +461,7 @@ public function testCreateViewDifferentAttributesClosure()
458461 {
459462 $ attr1 = function () {};
460463 $ attr2 = function () {};
461- $ list = $ this ->getMockBuilder (\ Symfony \ Component \ Form \ ChoiceList \ ChoiceListInterface::class)-> getMock ( );
464+ $ list = $ this ->createMock ( ChoiceListInterface::class);
462465 $ view1 = new ChoiceListView ();
463466 $ view2 = new ChoiceListView ();
464467
0 commit comments