Skip to content

Commit c56487b

Browse files
committed
Merge branch '3.1' into 3.2
* 3.1: fixed obsolete getMock() usage fixed obsolete getMock() usage fixed obsolete getMock() usage [WebProfilerBundle] Display multiple HTTP headers in WDT do not remove the Twig ExceptionController service removed obsolete condition do not try to register incomplete definitions
2 parents 103f62d + 3e75e4c commit c56487b

37 files changed

+189
-203
lines changed

Tests/AbstractFormTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ abstract class AbstractFormTest extends \PHPUnit_Framework_TestCase
3535
protected function setUp()
3636
{
3737
$this->dispatcher = new EventDispatcher();
38-
$this->factory = $this->getMock('Symfony\Component\Form\FormFactoryInterface');
38+
$this->factory = $this->getMockBuilder('Symfony\Component\Form\FormFactoryInterface')->getMock();
3939
$this->form = $this->createForm();
4040
}
4141

@@ -71,8 +71,8 @@ protected function getBuilder($name = 'name', EventDispatcherInterface $dispatch
7171
*/
7272
protected function getMockForm($name = 'name')
7373
{
74-
$form = $this->getMock('Symfony\Component\Form\Test\FormInterface');
75-
$config = $this->getMock('Symfony\Component\Form\FormConfigInterface');
74+
$form = $this->getMockBuilder('Symfony\Component\Form\Test\FormInterface')->getMock();
75+
$config = $this->getMockBuilder('Symfony\Component\Form\FormConfigInterface')->getMock();
7676

7777
$form->expects($this->any())
7878
->method('getName')
@@ -89,22 +89,22 @@ protected function getMockForm($name = 'name')
8989
*/
9090
protected function getDataMapper()
9191
{
92-
return $this->getMock('Symfony\Component\Form\DataMapperInterface');
92+
return $this->getMockBuilder('Symfony\Component\Form\DataMapperInterface')->getMock();
9393
}
9494

9595
/**
9696
* @return \PHPUnit_Framework_MockObject_MockObject
9797
*/
9898
protected function getDataTransformer()
9999
{
100-
return $this->getMock('Symfony\Component\Form\DataTransformerInterface');
100+
return $this->getMockBuilder('Symfony\Component\Form\DataTransformerInterface')->getMock();
101101
}
102102

103103
/**
104104
* @return \PHPUnit_Framework_MockObject_MockObject
105105
*/
106106
protected function getFormValidator()
107107
{
108-
return $this->getMock('Symfony\Component\Form\FormValidatorInterface');
108+
return $this->getMockBuilder('Symfony\Component\Form\FormValidatorInterface')->getMock();
109109
}
110110
}

Tests/AbstractLayoutTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ protected function setUp()
2828

2929
\Locale::setDefault('en');
3030

31-
$this->csrfTokenManager = $this->getMock('Symfony\Component\Security\Csrf\CsrfTokenManagerInterface');
31+
$this->csrfTokenManager = $this->getMockBuilder('Symfony\Component\Security\Csrf\CsrfTokenManagerInterface')->getMock();
3232

3333
parent::setUp();
3434
}

Tests/AbstractRequestHandlerTest.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,7 @@ abstract class AbstractRequestHandlerTest extends \PHPUnit_Framework_TestCase
3737

3838
protected function setUp()
3939
{
40-
$this->serverParams = $this->getMock(
41-
'Symfony\Component\Form\Util\ServerParams',
42-
array('getNormalizedIniPostMaxSize', 'getContentLength')
43-
);
40+
$this->serverParams = $this->getMockBuilder('Symfony\Component\Form\Util\ServerParams')->setMethods(array('getNormalizedIniPostMaxSize', 'getContentLength'))->getMock();
4441
$this->requestHandler = $this->getRequestHandler();
4542
$this->factory = Forms::createFormFactoryBuilder()->getFormFactory();
4643
$this->request = null;
@@ -363,15 +360,15 @@ abstract protected function getMockFile($suffix = '');
363360

364361
protected function getMockForm($name, $method = null, $compound = true)
365362
{
366-
$config = $this->getMock('Symfony\Component\Form\FormConfigInterface');
363+
$config = $this->getMockBuilder('Symfony\Component\Form\FormConfigInterface')->getMock();
367364
$config->expects($this->any())
368365
->method('getMethod')
369366
->will($this->returnValue($method));
370367
$config->expects($this->any())
371368
->method('getCompound')
372369
->will($this->returnValue($compound));
373370

374-
$form = $this->getMock('Symfony\Component\Form\Test\FormInterface');
371+
$form = $this->getMockBuilder('Symfony\Component\Form\Test\FormInterface')->getMock();
375372
$form->expects($this->any())
376373
->method('getName')
377374
->will($this->returnValue($name));

Tests/ButtonTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ class ButtonTest extends \PHPUnit_Framework_TestCase
2525

2626
protected function setUp()
2727
{
28-
$this->dispatcher = $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface');
29-
$this->factory = $this->getMock('Symfony\Component\Form\FormFactoryInterface');
28+
$this->dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcherInterface')->getMock();
29+
$this->factory = $this->getMockBuilder('Symfony\Component\Form\FormFactoryInterface')->getMock();
3030
}
3131

3232
/**

Tests/ChoiceList/Factory/CachingFactoryDecoratorTest.php

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class CachingFactoryDecoratorTest extends \PHPUnit_Framework_TestCase
3030

3131
protected function setUp()
3232
{
33-
$this->decoratedFactory = $this->getMock('Symfony\Component\Form\ChoiceList\Factory\ChoiceListFactoryInterface');
33+
$this->decoratedFactory = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\Factory\ChoiceListFactoryInterface')->getMock();
3434
$this->factory = new CachingFactoryDecorator($this->decoratedFactory);
3535
}
3636

@@ -157,7 +157,7 @@ public function testCreateFromChoicesDifferentValueClosure()
157157

158158
public function testCreateFromLoaderSameLoader()
159159
{
160-
$loader = $this->getMock('Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface');
160+
$loader = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface')->getMock();
161161
$list = new \stdClass();
162162

163163
$this->decoratedFactory->expects($this->once())
@@ -171,8 +171,8 @@ public function testCreateFromLoaderSameLoader()
171171

172172
public function testCreateFromLoaderDifferentLoader()
173173
{
174-
$loader1 = $this->getMock('Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface');
175-
$loader2 = $this->getMock('Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface');
174+
$loader1 = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface')->getMock();
175+
$loader2 = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface')->getMock();
176176
$list1 = new \stdClass();
177177
$list2 = new \stdClass();
178178

@@ -191,7 +191,7 @@ public function testCreateFromLoaderDifferentLoader()
191191

192192
public function testCreateFromLoaderSameValueClosure()
193193
{
194-
$loader = $this->getMock('Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface');
194+
$loader = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface')->getMock();
195195
$list = new \stdClass();
196196
$closure = function () {};
197197

@@ -206,7 +206,7 @@ public function testCreateFromLoaderSameValueClosure()
206206

207207
public function testCreateFromLoaderDifferentValueClosure()
208208
{
209-
$loader = $this->getMock('Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface');
209+
$loader = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface')->getMock();
210210
$list1 = new \stdClass();
211211
$list2 = new \stdClass();
212212
$closure1 = function () {};
@@ -228,7 +228,7 @@ public function testCreateFromLoaderDifferentValueClosure()
228228
public function testCreateViewSamePreferredChoices()
229229
{
230230
$preferred = array('a');
231-
$list = $this->getMock('Symfony\Component\Form\ChoiceList\ChoiceListInterface');
231+
$list = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\ChoiceListInterface')->getMock();
232232
$view = new \stdClass();
233233

234234
$this->decoratedFactory->expects($this->once())
@@ -244,7 +244,7 @@ public function testCreateViewDifferentPreferredChoices()
244244
{
245245
$preferred1 = array('a');
246246
$preferred2 = array('b');
247-
$list = $this->getMock('Symfony\Component\Form\ChoiceList\ChoiceListInterface');
247+
$list = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\ChoiceListInterface')->getMock();
248248
$view1 = new \stdClass();
249249
$view2 = new \stdClass();
250250

@@ -264,7 +264,7 @@ public function testCreateViewDifferentPreferredChoices()
264264
public function testCreateViewSamePreferredChoicesClosure()
265265
{
266266
$preferred = function () {};
267-
$list = $this->getMock('Symfony\Component\Form\ChoiceList\ChoiceListInterface');
267+
$list = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\ChoiceListInterface')->getMock();
268268
$view = new \stdClass();
269269

270270
$this->decoratedFactory->expects($this->once())
@@ -280,7 +280,7 @@ public function testCreateViewDifferentPreferredChoicesClosure()
280280
{
281281
$preferred1 = function () {};
282282
$preferred2 = function () {};
283-
$list = $this->getMock('Symfony\Component\Form\ChoiceList\ChoiceListInterface');
283+
$list = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\ChoiceListInterface')->getMock();
284284
$view1 = new \stdClass();
285285
$view2 = new \stdClass();
286286

@@ -300,7 +300,7 @@ public function testCreateViewDifferentPreferredChoicesClosure()
300300
public function testCreateViewSameLabelClosure()
301301
{
302302
$labels = function () {};
303-
$list = $this->getMock('Symfony\Component\Form\ChoiceList\ChoiceListInterface');
303+
$list = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\ChoiceListInterface')->getMock();
304304
$view = new \stdClass();
305305

306306
$this->decoratedFactory->expects($this->once())
@@ -316,7 +316,7 @@ public function testCreateViewDifferentLabelClosure()
316316
{
317317
$labels1 = function () {};
318318
$labels2 = function () {};
319-
$list = $this->getMock('Symfony\Component\Form\ChoiceList\ChoiceListInterface');
319+
$list = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\ChoiceListInterface')->getMock();
320320
$view1 = new \stdClass();
321321
$view2 = new \stdClass();
322322

@@ -336,7 +336,7 @@ public function testCreateViewDifferentLabelClosure()
336336
public function testCreateViewSameIndexClosure()
337337
{
338338
$index = function () {};
339-
$list = $this->getMock('Symfony\Component\Form\ChoiceList\ChoiceListInterface');
339+
$list = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\ChoiceListInterface')->getMock();
340340
$view = new \stdClass();
341341

342342
$this->decoratedFactory->expects($this->once())
@@ -352,7 +352,7 @@ public function testCreateViewDifferentIndexClosure()
352352
{
353353
$index1 = function () {};
354354
$index2 = function () {};
355-
$list = $this->getMock('Symfony\Component\Form\ChoiceList\ChoiceListInterface');
355+
$list = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\ChoiceListInterface')->getMock();
356356
$view1 = new \stdClass();
357357
$view2 = new \stdClass();
358358

@@ -372,7 +372,7 @@ public function testCreateViewDifferentIndexClosure()
372372
public function testCreateViewSameGroupByClosure()
373373
{
374374
$groupBy = function () {};
375-
$list = $this->getMock('Symfony\Component\Form\ChoiceList\ChoiceListInterface');
375+
$list = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\ChoiceListInterface')->getMock();
376376
$view = new \stdClass();
377377

378378
$this->decoratedFactory->expects($this->once())
@@ -388,7 +388,7 @@ public function testCreateViewDifferentGroupByClosure()
388388
{
389389
$groupBy1 = function () {};
390390
$groupBy2 = function () {};
391-
$list = $this->getMock('Symfony\Component\Form\ChoiceList\ChoiceListInterface');
391+
$list = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\ChoiceListInterface')->getMock();
392392
$view1 = new \stdClass();
393393
$view2 = new \stdClass();
394394

@@ -408,7 +408,7 @@ public function testCreateViewDifferentGroupByClosure()
408408
public function testCreateViewSameAttributes()
409409
{
410410
$attr = array('class' => 'foobar');
411-
$list = $this->getMock('Symfony\Component\Form\ChoiceList\ChoiceListInterface');
411+
$list = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\ChoiceListInterface')->getMock();
412412
$view = new \stdClass();
413413

414414
$this->decoratedFactory->expects($this->once())
@@ -424,7 +424,7 @@ public function testCreateViewDifferentAttributes()
424424
{
425425
$attr1 = array('class' => 'foobar1');
426426
$attr2 = array('class' => 'foobar2');
427-
$list = $this->getMock('Symfony\Component\Form\ChoiceList\ChoiceListInterface');
427+
$list = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\ChoiceListInterface')->getMock();
428428
$view1 = new \stdClass();
429429
$view2 = new \stdClass();
430430

@@ -444,7 +444,7 @@ public function testCreateViewDifferentAttributes()
444444
public function testCreateViewSameAttributesClosure()
445445
{
446446
$attr = function () {};
447-
$list = $this->getMock('Symfony\Component\Form\ChoiceList\ChoiceListInterface');
447+
$list = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\ChoiceListInterface')->getMock();
448448
$view = new \stdClass();
449449

450450
$this->decoratedFactory->expects($this->once())
@@ -460,7 +460,7 @@ public function testCreateViewDifferentAttributesClosure()
460460
{
461461
$attr1 = function () {};
462462
$attr2 = function () {};
463-
$list = $this->getMock('Symfony\Component\Form\ChoiceList\ChoiceListInterface');
463+
$list = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\ChoiceListInterface')->getMock();
464464
$view1 = new \stdClass();
465465
$view2 = new \stdClass();
466466

Tests/ChoiceList/Factory/DefaultChoiceListFactoryTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ function ($object) { return $object->value; }
193193

194194
public function testCreateFromLoader()
195195
{
196-
$loader = $this->getMock('Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface');
196+
$loader = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface')->getMock();
197197

198198
$list = $this->factory->createListFromLoader($loader);
199199

@@ -202,7 +202,7 @@ public function testCreateFromLoader()
202202

203203
public function testCreateFromLoaderWithValues()
204204
{
205-
$loader = $this->getMock('Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface');
205+
$loader = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface')->getMock();
206206

207207
$value = function () {};
208208
$list = $this->factory->createListFromLoader($loader, $value);

0 commit comments

Comments
 (0)