Skip to content

Commit 1bf13e8

Browse files
committed
Merge branch '2.7' into 2.8
* 2.7: fixed obsolete getMock() usage [WebProfilerBundle] Display multiple HTTP headers in WDT
2 parents df9a4f8 + 727bf35 commit 1bf13e8

File tree

7 files changed

+22
-22
lines changed

7 files changed

+22
-22
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/ClassMetadataFactoryTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public function testHasMetadataFor()
4747

4848
public function testCacheExists()
4949
{
50-
$cache = $this->getMock('Doctrine\Common\Cache\Cache');
50+
$cache = $this->getMockBuilder('Doctrine\Common\Cache\Cache')->getMock();
5151
$cache
5252
->expects($this->once())
5353
->method('fetch')
@@ -60,7 +60,7 @@ public function testCacheExists()
6060

6161
public function testCacheNotExists()
6262
{
63-
$cache = $this->getMock('Doctrine\Common\Cache\Cache');
63+
$cache = $this->getMockBuilder('Doctrine\Common\Cache\Cache')->getMock();
6464
$cache
6565
->method('fetch')
6666
->will($this->returnValue(false))

Tests/Normalizer/AbstractNormalizerTest.php

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

3030
protected function setUp()
3131
{
32-
$loader = $this->getMock('Symfony\Component\Serializer\Mapping\Loader\LoaderChain', array(), array(array()));
33-
$this->classMetadata = $this->getMock('Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactory', array(), array($loader));
32+
$loader = $this->getMockBuilder('Symfony\Component\Serializer\Mapping\Loader\LoaderChain')->setConstructorArgs(array(array()))->getMock();
33+
$this->classMetadata = $this->getMockBuilder('Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactory')->setConstructorArgs(array($loader))->getMock();
3434
$this->normalizer = new AbstractNormalizerDummy($this->classMetadata);
3535
}
3636

Tests/Normalizer/GetSetMethodNormalizerTest.php

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

3737
protected function setUp()
3838
{
39-
$this->serializer = $this->getMock(__NAMESPACE__.'\SerializerNormalizer');
39+
$this->serializer = $this->getMockBuilder(__NAMESPACE__.'\SerializerNormalizer')->getMock();
4040
$this->normalizer = new GetSetMethodNormalizer();
4141
$this->normalizer->setSerializer($this->serializer);
4242
}
@@ -470,7 +470,7 @@ public function provideCallbacks()
470470
*/
471471
public function testUnableToNormalizeObjectAttribute()
472472
{
473-
$serializer = $this->getMock('Symfony\Component\Serializer\SerializerInterface');
473+
$serializer = $this->getMockBuilder('Symfony\Component\Serializer\SerializerInterface')->getMock();
474474
$this->normalizer->setSerializer($serializer);
475475

476476
$obj = new GetSetDummy();

Tests/Normalizer/ObjectNormalizerTest.php

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

4040
protected function setUp()
4141
{
42-
$this->serializer = $this->getMock(__NAMESPACE__.'\ObjectSerializerNormalizer');
42+
$this->serializer = $this->getMockBuilder(__NAMESPACE__.'\ObjectSerializerNormalizer')->getMock();
4343
$this->normalizer = new ObjectNormalizer();
4444
$this->normalizer->setSerializer($this->serializer);
4545
}
@@ -416,7 +416,7 @@ public function provideCallbacks()
416416
*/
417417
public function testUnableToNormalizeObjectAttribute()
418418
{
419-
$serializer = $this->getMock('Symfony\Component\Serializer\SerializerInterface');
419+
$serializer = $this->getMockBuilder('Symfony\Component\Serializer\SerializerInterface')->getMock();
420420
$this->normalizer->setSerializer($serializer);
421421

422422
$obj = new ObjectDummy();

Tests/Normalizer/PropertyNormalizerTest.php

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

3636
protected function setUp()
3737
{
38-
$this->serializer = $this->getMock('Symfony\Component\Serializer\SerializerInterface');
38+
$this->serializer = $this->getMockBuilder('Symfony\Component\Serializer\SerializerInterface')->getMock();
3939
$this->normalizer = new PropertyNormalizer();
4040
$this->normalizer->setSerializer($this->serializer);
4141
}
@@ -423,7 +423,7 @@ public function testDenormalizeShouldIgnoreStaticProperty()
423423
*/
424424
public function testUnableToNormalizeObjectAttribute()
425425
{
426-
$serializer = $this->getMock('Symfony\Component\Serializer\SerializerInterface');
426+
$serializer = $this->getMockBuilder('Symfony\Component\Serializer\SerializerInterface')->getMock();
427427
$this->normalizer->setSerializer($serializer);
428428

429429
$obj = new PropertyDummy();

Tests/SerializerTest.php

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

@@ -73,7 +73,7 @@ public function testNormalizeOnDenormalizer()
7373
*/
7474
public function testDenormalizeNoMatch()
7575
{
76-
$serializer = new Serializer(array($this->getMock('Symfony\Component\Serializer\Normalizer\CustomNormalizer')));
76+
$serializer = new Serializer(array($this->getMockBuilder('Symfony\Component\Serializer\Normalizer\CustomNormalizer')->getMock()));
7777
$serializer->denormalize('foo', 'stdClass');
7878
}
7979

@@ -98,14 +98,14 @@ public function testCustomNormalizerCanNormalizeCollectionsAndScalar()
9898

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

108-
$normalizer2 = $this->getMock('Symfony\Component\Serializer\Normalizer\NormalizerInterface');
108+
$normalizer2 = $this->getMockBuilder('Symfony\Component\Serializer\Normalizer\NormalizerInterface')->getMock();
109109
$normalizer2->method('supportsNormalization')
110110
->willReturn(true);
111111
$normalizer2->method('normalize')->willReturn('test2');
@@ -121,14 +121,14 @@ public function testNormalizeWithSupportOnData()
121121

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

131-
$denormalizer2 = $this->getMock('Symfony\Component\Serializer\Normalizer\DenormalizerInterface');
131+
$denormalizer2 = $this->getMockBuilder('Symfony\Component\Serializer\Normalizer\DenormalizerInterface')->getMock();
132132
$denormalizer2->method('supportsDenormalization')
133133
->willReturn(true);
134134
$denormalizer2->method('denormalize')->willReturn('test2');

0 commit comments

Comments
 (0)