Skip to content

Commit 0fb2237

Browse files
committed
Merge branch '2.8' into 3.1
* 2.8: 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 8f86ba6 + 517df38 commit 0fb2237

7 files changed

+21
-21
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/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/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/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
}
@@ -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 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: 6 additions & 6 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');

0 commit comments

Comments
 (0)