Skip to content

Commit 949d26c

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 310eae4 + 7da5e62 commit 949d26c

10 files changed

+29
-29
lines changed

Tests/Mapping/ClassMetadataTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ public function testAttributeMetadata()
2828
{
2929
$classMetadata = new ClassMetadata('c');
3030

31-
$a1 = $this->getMock('Symfony\Component\Serializer\Mapping\AttributeMetadataInterface');
31+
$a1 = $this->getMockBuilder('Symfony\Component\Serializer\Mapping\AttributeMetadataInterface')->getMock();
3232
$a1->method('getName')->willReturn('a1');
3333

34-
$a2 = $this->getMock('Symfony\Component\Serializer\Mapping\AttributeMetadataInterface');
34+
$a2 = $this->getMockBuilder('Symfony\Component\Serializer\Mapping\AttributeMetadataInterface')->getMock();
3535
$a2->method('getName')->willReturn('a2');
3636

3737
$classMetadata->addAttributeMetadata($a1);
@@ -45,11 +45,11 @@ public function testMerge()
4545
$classMetadata1 = new ClassMetadata('c1');
4646
$classMetadata2 = new ClassMetadata('c2');
4747

48-
$ac1 = $this->getMock('Symfony\Component\Serializer\Mapping\AttributeMetadataInterface');
48+
$ac1 = $this->getMockBuilder('Symfony\Component\Serializer\Mapping\AttributeMetadataInterface')->getMock();
4949
$ac1->method('getName')->willReturn('a1');
5050
$ac1->method('getGroups')->willReturn(array('a', 'b'));
5151

52-
$ac2 = $this->getMock('Symfony\Component\Serializer\Mapping\AttributeMetadataInterface');
52+
$ac2 = $this->getMockBuilder('Symfony\Component\Serializer\Mapping\AttributeMetadataInterface')->getMock();
5353
$ac2->method('getName')->willReturn('a1');
5454
$ac2->method('getGroups')->willReturn(array('b', 'c'));
5555

@@ -67,10 +67,10 @@ public function testSerialize()
6767
{
6868
$classMetadata = new ClassMetadata('a');
6969

70-
$a1 = $this->getMock('Symfony\Component\Serializer\Mapping\AttributeMetadataInterface');
70+
$a1 = $this->getMockBuilder('Symfony\Component\Serializer\Mapping\AttributeMetadataInterface')->getMock();
7171
$a1->method('getName')->willReturn('b1');
7272

73-
$a2 = $this->getMock('Symfony\Component\Serializer\Mapping\AttributeMetadataInterface');
73+
$a2 = $this->getMockBuilder('Symfony\Component\Serializer\Mapping\AttributeMetadataInterface')->getMock();
7474
$a2->method('getName')->willReturn('b2');
7575

7676
$classMetadata->addAttributeMetadata($a1);

Tests/Mapping/Factory/CacheMetadataFactoryTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public function testGetMetadataFor()
2626
{
2727
$metadata = new ClassMetadata(Dummy::class);
2828

29-
$decorated = $this->getMock(ClassMetadataFactoryInterface::class);
29+
$decorated = $this->getMockBuilder(ClassMetadataFactoryInterface::class)->getMock();
3030
$decorated
3131
->expects($this->once())
3232
->method('getMetadataFor')
@@ -42,7 +42,7 @@ public function testGetMetadataFor()
4242

4343
public function testHasMetadataFor()
4444
{
45-
$decorated = $this->getMock(ClassMetadataFactoryInterface::class);
45+
$decorated = $this->getMockBuilder(ClassMetadataFactoryInterface::class)->getMock();
4646
$decorated
4747
->expects($this->once())
4848
->method('hasMetadataFor')
@@ -59,7 +59,7 @@ public function testHasMetadataFor()
5959
*/
6060
public function testInvalidClassThrowsException()
6161
{
62-
$decorated = $this->getMock(ClassMetadataFactoryInterface::class);
62+
$decorated = $this->getMockBuilder(ClassMetadataFactoryInterface::class)->getMock();
6363
$factory = new CacheClassMetadataFactory($decorated, new ArrayAdapter());
6464

6565
$factory->getMetadataFor('Not\Exist');

Tests/Mapping/Factory/ClassMetadataFactoryTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public function testHasMetadataFor()
5050
*/
5151
public function testCacheExists()
5252
{
53-
$cache = $this->getMock('Doctrine\Common\Cache\Cache');
53+
$cache = $this->getMockBuilder('Doctrine\Common\Cache\Cache')->getMock();
5454
$cache
5555
->expects($this->once())
5656
->method('fetch')
@@ -66,7 +66,7 @@ public function testCacheExists()
6666
*/
6767
public function testCacheNotExists()
6868
{
69-
$cache = $this->getMock('Doctrine\Common\Cache\Cache');
69+
$cache = $this->getMockBuilder('Doctrine\Common\Cache\Cache')->getMock();
7070
$cache->method('fetch')->will($this->returnValue(false));
7171
$cache->method('save');
7272

Tests/Normalizer/AbstractNormalizerTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ class AbstractNormalizerTest extends \PHPUnit_Framework_TestCase
3131

3232
protected function setUp()
3333
{
34-
$loader = $this->getMock('Symfony\Component\Serializer\Mapping\Loader\LoaderChain', array(), array(array()));
35-
$this->classMetadata = $this->getMock('Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactory', array(), array($loader));
34+
$loader = $this->getMockBuilder('Symfony\Component\Serializer\Mapping\Loader\LoaderChain')->setConstructorArgs(array(array()))->getMock();
35+
$this->classMetadata = $this->getMockBuilder('Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactory')->setConstructorArgs(array($loader))->getMock();
3636
$this->normalizer = new AbstractNormalizerDummy($this->classMetadata);
3737
}
3838

Tests/Normalizer/ArrayDenormalizerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class ArrayDenormalizerTest extends \PHPUnit_Framework_TestCase
2828

2929
protected function setUp()
3030
{
31-
$this->serializer = $this->getMock('Symfony\Component\Serializer\Serializer');
31+
$this->serializer = $this->getMockBuilder('Symfony\Component\Serializer\Serializer')->getMock();
3232
$this->denormalizer = new ArrayDenormalizer();
3333
$this->denormalizer->setSerializer($this->serializer);
3434
}

Tests/Normalizer/GetSetMethodNormalizerTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class GetSetMethodNormalizerTest extends \PHPUnit_Framework_TestCase
3737

3838
protected function setUp()
3939
{
40-
$this->serializer = $this->getMock(__NAMESPACE__.'\SerializerNormalizer');
40+
$this->serializer = $this->getMockBuilder(__NAMESPACE__.'\SerializerNormalizer')->getMock();
4141
$this->normalizer = new GetSetMethodNormalizer();
4242
$this->normalizer->setSerializer($this->serializer);
4343
}
@@ -394,7 +394,7 @@ public function provideCallbacks()
394394
*/
395395
public function testUnableToNormalizeObjectAttribute()
396396
{
397-
$serializer = $this->getMock('Symfony\Component\Serializer\SerializerInterface');
397+
$serializer = $this->getMockBuilder('Symfony\Component\Serializer\SerializerInterface')->getMock();
398398
$this->normalizer->setSerializer($serializer);
399399

400400
$obj = new GetSetDummy();

Tests/Normalizer/JsonSerializableNormalizerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class JsonSerializableNormalizerTest extends \PHPUnit_Framework_TestCase
3333

3434
protected function setUp()
3535
{
36-
$this->serializer = $this->getMock(JsonSerializerNormalizer::class);
36+
$this->serializer = $this->getMockBuilder(JsonSerializerNormalizer::class)->getMock();
3737
$this->normalizer = new JsonSerializableNormalizer();
3838
$this->normalizer->setSerializer($this->serializer);
3939
}

Tests/Normalizer/ObjectNormalizerTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class ObjectNormalizerTest extends \PHPUnit_Framework_TestCase
4545

4646
protected function setUp()
4747
{
48-
$this->serializer = $this->getMock(__NAMESPACE__.'\ObjectSerializerNormalizer');
48+
$this->serializer = $this->getMockBuilder(__NAMESPACE__.'\ObjectSerializerNormalizer')->getMock();
4949
$this->normalizer = new ObjectNormalizer();
5050
$this->normalizer->setSerializer($this->serializer);
5151
}
@@ -437,7 +437,7 @@ public function provideCallbacks()
437437
*/
438438
public function testUnableToNormalizeObjectAttribute()
439439
{
440-
$serializer = $this->getMock('Symfony\Component\Serializer\SerializerInterface');
440+
$serializer = $this->getMockBuilder('Symfony\Component\Serializer\SerializerInterface')->getMock();
441441
$this->normalizer->setSerializer($serializer);
442442

443443
$obj = new ObjectDummy();

Tests/Normalizer/PropertyNormalizerTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class PropertyNormalizerTest extends \PHPUnit_Framework_TestCase
3636

3737
protected function setUp()
3838
{
39-
$this->serializer = $this->getMock('Symfony\Component\Serializer\SerializerInterface');
39+
$this->serializer = $this->getMockBuilder('Symfony\Component\Serializer\SerializerInterface')->getMock();
4040
$this->normalizer = new PropertyNormalizer();
4141
$this->normalizer->setSerializer($this->serializer);
4242
}
@@ -353,7 +353,7 @@ public function testDenormalizeShouldIgnoreStaticProperty()
353353
*/
354354
public function testUnableToNormalizeObjectAttribute()
355355
{
356-
$serializer = $this->getMock('Symfony\Component\Serializer\SerializerInterface');
356+
$serializer = $this->getMockBuilder('Symfony\Component\Serializer\SerializerInterface')->getMock();
357357
$this->normalizer->setSerializer($serializer);
358358

359359
$obj = new PropertyDummy();

Tests/SerializerTest.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public function testInterface()
4545
*/
4646
public function testNormalizeNoMatch()
4747
{
48-
$serializer = new Serializer(array($this->getMock('Symfony\Component\Serializer\Normalizer\CustomNormalizer')));
48+
$serializer = new Serializer(array($this->getMockBuilder('Symfony\Component\Serializer\Normalizer\CustomNormalizer')->getMock()));
4949
$serializer->normalize(new \stdClass(), 'xml');
5050
}
5151

@@ -77,7 +77,7 @@ public function testNormalizeOnDenormalizer()
7777
*/
7878
public function testDenormalizeNoMatch()
7979
{
80-
$serializer = new Serializer(array($this->getMock('Symfony\Component\Serializer\Normalizer\CustomNormalizer')));
80+
$serializer = new Serializer(array($this->getMockBuilder('Symfony\Component\Serializer\Normalizer\CustomNormalizer')->getMock()));
8181
$serializer->denormalize('foo', 'stdClass');
8282
}
8383

@@ -102,14 +102,14 @@ public function testCustomNormalizerCanNormalizeCollectionsAndScalar()
102102

103103
public function testNormalizeWithSupportOnData()
104104
{
105-
$normalizer1 = $this->getMock('Symfony\Component\Serializer\Normalizer\NormalizerInterface');
105+
$normalizer1 = $this->getMockBuilder('Symfony\Component\Serializer\Normalizer\NormalizerInterface')->getMock();
106106
$normalizer1->method('supportsNormalization')
107107
->willReturnCallback(function ($data, $format) {
108108
return isset($data->test);
109109
});
110110
$normalizer1->method('normalize')->willReturn('test1');
111111

112-
$normalizer2 = $this->getMock('Symfony\Component\Serializer\Normalizer\NormalizerInterface');
112+
$normalizer2 = $this->getMockBuilder('Symfony\Component\Serializer\Normalizer\NormalizerInterface')->getMock();
113113
$normalizer2->method('supportsNormalization')
114114
->willReturn(true);
115115
$normalizer2->method('normalize')->willReturn('test2');
@@ -125,14 +125,14 @@ public function testNormalizeWithSupportOnData()
125125

126126
public function testDenormalizeWithSupportOnData()
127127
{
128-
$denormalizer1 = $this->getMock('Symfony\Component\Serializer\Normalizer\DenormalizerInterface');
128+
$denormalizer1 = $this->getMockBuilder('Symfony\Component\Serializer\Normalizer\DenormalizerInterface')->getMock();
129129
$denormalizer1->method('supportsDenormalization')
130130
->willReturnCallback(function ($data, $type, $format) {
131131
return isset($data['test1']);
132132
});
133133
$denormalizer1->method('denormalize')->willReturn('test1');
134134

135-
$denormalizer2 = $this->getMock('Symfony\Component\Serializer\Normalizer\DenormalizerInterface');
135+
$denormalizer2 = $this->getMockBuilder('Symfony\Component\Serializer\Normalizer\DenormalizerInterface')->getMock();
136136
$denormalizer2->method('supportsDenormalization')
137137
->willReturn(true);
138138
$denormalizer2->method('denormalize')->willReturn('test2');
@@ -319,7 +319,7 @@ public function testDeserializeArray()
319319

320320
public function testNormalizerAware()
321321
{
322-
$normalizerAware = $this->getMock(NormalizerAwareInterface::class);
322+
$normalizerAware = $this->getMockBuilder(NormalizerAwareInterface::class)->getMock();
323323
$normalizerAware->expects($this->once())
324324
->method('setNormalizer')
325325
->with($this->isInstanceOf(NormalizerInterface::class));
@@ -329,7 +329,7 @@ public function testNormalizerAware()
329329

330330
public function testDenormalizerAware()
331331
{
332-
$denormalizerAware = $this->getMock(DenormalizerAwareInterface::class);
332+
$denormalizerAware = $this->getMockBuilder(DenormalizerAwareInterface::class)->getMock();
333333
$denormalizerAware->expects($this->once())
334334
->method('setDenormalizer')
335335
->with($this->isInstanceOf(DenormalizerInterface::class));

0 commit comments

Comments
 (0)