Skip to content

Commit 6d0d04e

Browse files
More cleanups and fixes
1 parent a86975f commit 6d0d04e

File tree

5 files changed

+15
-14
lines changed

5 files changed

+15
-14
lines changed

Tests/ChoiceList/Factory/CachingFactoryDecoratorTest.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ public function testCreateFromChoicesDifferentFilterClosure()
239239

240240
public function testCreateFromLoaderSameLoader()
241241
{
242-
$loader = $this->getMockBuilder(ChoiceLoaderInterface::class)->getMock();
242+
$loader = $this->createMock(ChoiceLoaderInterface::class);
243243
$list = new ArrayChoiceList([]);
244244
$list2 = new ArrayChoiceList([]);
245245

@@ -270,8 +270,8 @@ public function testCreateFromLoaderSameLoaderUseCache()
270270

271271
public function testCreateFromLoaderDifferentLoader()
272272
{
273-
$loader1 = $this->getMockBuilder(ChoiceLoaderInterface::class)->getMock();
274-
$loader2 = $this->getMockBuilder(ChoiceLoaderInterface::class)->getMock();
273+
$loader1 = $this->createMock(ChoiceLoaderInterface::class);
274+
$loader2 = $this->createMock(ChoiceLoaderInterface::class);
275275
$list1 = new ArrayChoiceList([]);
276276
$list2 = new ArrayChoiceList([]);
277277

@@ -289,7 +289,7 @@ public function testCreateFromLoaderDifferentLoader()
289289

290290
public function testCreateFromLoaderSameValueClosure()
291291
{
292-
$loader = $this->getMockBuilder(ChoiceLoaderInterface::class)->getMock();
292+
$loader = $this->createMock(ChoiceLoaderInterface::class);
293293
$type = $this->createMock(FormTypeInterface::class);
294294
$list = new ArrayChoiceList([]);
295295
$list2 = new ArrayChoiceList([]);
@@ -329,7 +329,7 @@ public function testCreateFromLoaderSameValueClosureUseCache()
329329

330330
public function testCreateFromLoaderDifferentValueClosure()
331331
{
332-
$loader = $this->getMockBuilder(ChoiceLoaderInterface::class)->getMock();
332+
$loader = $this->createMock(ChoiceLoaderInterface::class);
333333
$type = $this->createMock(FormTypeInterface::class);
334334
$list1 = new ArrayChoiceList([]);
335335
$list2 = new ArrayChoiceList([]);
@@ -350,7 +350,7 @@ public function testCreateFromLoaderDifferentValueClosure()
350350

351351
public function testCreateFromLoaderSameFilterClosure()
352352
{
353-
$loader = $this->getMockBuilder(ChoiceLoaderInterface::class)->getMock();
353+
$loader = $this->createMock(ChoiceLoaderInterface::class);
354354
$type = $this->createMock(FormTypeInterface::class);
355355
$list = new ArrayChoiceList([]);
356356
$list2 = new ArrayChoiceList([]);
@@ -392,7 +392,7 @@ public function testCreateFromLoaderSameFilterClosureUseCache()
392392

393393
public function testCreateFromLoaderDifferentFilterClosure()
394394
{
395-
$loader = $this->getMockBuilder(ChoiceLoaderInterface::class)->getMock();
395+
$loader = $this->createMock(ChoiceLoaderInterface::class);
396396
$type = $this->createMock(FormTypeInterface::class);
397397
$list1 = new ArrayChoiceList([]);
398398
$list2 = new ArrayChoiceList([]);

Tests/ChoiceList/Factory/DefaultChoiceListFactoryTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ public function testCreateFromLoaderWithValues()
267267

268268
public function testCreateFromLoaderWithFilter()
269269
{
270-
$loader = $this->getMockBuilder(\Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface::class)->getMock();
270+
$loader = $this->createMock(ChoiceLoaderInterface::class);
271271
$filter = function () {};
272272

273273
$list = $this->factory->createListFromLoader($loader, null, $filter);

Tests/ChoiceList/Factory/PropertyAccessDecoratorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ public function testCreateFromLoaderPropertyPath()
127127

128128
public function testCreateFromLoaderFilterPropertyPath()
129129
{
130-
$loader = $this->getMockBuilder(\Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface::class)->getMock();
130+
$loader = $this->createMock(ChoiceLoaderInterface::class);
131131
$filteredChoices = [
132132
'two' => (object) ['property' => 'value 2', 'filter' => true],
133133
];

Tests/ChoiceList/Loader/FilterChoiceLoaderDecoratorTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class FilterChoiceLoaderDecoratorTest extends TestCase
1111
{
1212
public function testLoadChoiceList()
1313
{
14-
$decorated = $this->getMockBuilder(ChoiceLoaderInterface::class)->getMock();
14+
$decorated = $this->createMock(ChoiceLoaderInterface::class);
1515
$decorated->expects($this->once())
1616
->method('loadChoiceList')
1717
->willReturn(new ArrayChoiceList(range(1, 4)))
@@ -28,7 +28,7 @@ public function testLoadChoiceList()
2828

2929
public function testLoadChoiceListWithGroupedChoices()
3030
{
31-
$decorated = $this->getMockBuilder(ChoiceLoaderInterface::class)->getMock();
31+
$decorated = $this->createMock(ChoiceLoaderInterface::class);
3232
$decorated->expects($this->once())
3333
->method('loadChoiceList')
3434
->willReturn(new ArrayChoiceList(['units' => range(1, 9), 'tens' => range(10, 90, 10)]))
@@ -54,7 +54,7 @@ public function testLoadValuesForChoices()
5454
{
5555
$evenValues = [1 => '2', 3 => '4'];
5656

57-
$decorated = $this->getMockBuilder(ChoiceLoaderInterface::class)->getMock();
57+
$decorated = $this->createMock(ChoiceLoaderInterface::class);
5858
$decorated->expects($this->never())
5959
->method('loadChoiceList')
6060
;
@@ -78,7 +78,7 @@ public function testLoadChoicesForValues()
7878
$evenChoices = [1 => 2, 3 => 4];
7979
$values = array_map('strval', range(1, 4));
8080

81-
$decorated = $this->getMockBuilder(ChoiceLoaderInterface::class)->getMock();
81+
$decorated = $this->createMock(ChoiceLoaderInterface::class);
8282
$decorated->expects($this->never())
8383
->method('loadChoiceList')
8484
;

Tests/FormRendererTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
use PHPUnit\Framework\TestCase;
1515
use Symfony\Component\Form\FormRenderer;
16+
use Symfony\Component\Form\FormRendererEngineInterface;
1617
use Symfony\Component\Form\FormView;
1718

1819
class FormRendererTest extends TestCase
@@ -38,7 +39,7 @@ public function testRenderARenderedField()
3839
$formView->vars['name'] = 'foo';
3940
$formView->setRendered();
4041

41-
$engine = $this->getMockBuilder(\Symfony\Component\Form\FormRendererEngineInterface::class)->getMock();
42+
$engine = $this->createMock(FormRendererEngineInterface::class);
4243
$renderer = new FormRenderer($engine);
4344
$renderer->searchAndRenderBlock($formView, 'row');
4445
}

0 commit comments

Comments
 (0)