Skip to content

Commit 862121b

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 f991e07 + d554588 commit 862121b

25 files changed

+125
-151
lines changed

Tests/Command/RouterDebugCommandTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ private function getContainer()
6363
{
6464
$routeCollection = new RouteCollection();
6565
$routeCollection->add('foo', new Route('foo'));
66-
$router = $this->getMock('Symfony\Component\Routing\RouterInterface');
66+
$router = $this->getMockBuilder('Symfony\Component\Routing\RouterInterface')->getMock();
6767
$router
6868
->expects($this->any())
6969
->method('getRouteCollection')
@@ -74,7 +74,7 @@ private function getContainer()
7474
->disableOriginalConstructor()
7575
->getMock();
7676

77-
$container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface');
77+
$container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerInterface')->getMock();
7878
$container
7979
->expects($this->once())
8080
->method('has')

Tests/Command/RouterMatchCommandTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ private function getContainer()
6262
$routeCollection = new RouteCollection();
6363
$routeCollection->add('foo', new Route('foo'));
6464
$requestContext = new RequestContext();
65-
$router = $this->getMock('Symfony\Component\Routing\RouterInterface');
65+
$router = $this->getMockBuilder('Symfony\Component\Routing\RouterInterface')->getMock();
6666
$router
6767
->expects($this->any())
6868
->method('getRouteCollection')
@@ -78,7 +78,7 @@ private function getContainer()
7878
->disableOriginalConstructor()
7979
->getMock();
8080

81-
$container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface');
81+
$container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerInterface')->getMock();
8282
$container
8383
->expects($this->once())
8484
->method('has')

Tests/Command/TranslationDebugCommandTest.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public function testDebugDefaultDirectory()
6464

6565
public function testDebugCustomDirectory()
6666
{
67-
$kernel = $this->getMock('Symfony\Component\HttpKernel\KernelInterface');
67+
$kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\KernelInterface')->getMock();
6868
$kernel->expects($this->once())
6969
->method('getBundle')
7070
->with($this->equalTo($this->translationDir))
@@ -82,7 +82,7 @@ public function testDebugCustomDirectory()
8282
*/
8383
public function testDebugInvalidDirectory()
8484
{
85-
$kernel = $this->getMock('Symfony\Component\HttpKernel\KernelInterface');
85+
$kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\KernelInterface')->getMock();
8686
$kernel->expects($this->once())
8787
->method('getBundle')
8888
->with($this->equalTo('dir'))
@@ -130,7 +130,7 @@ private function getContainer($extractedMessages = array(), $loadedMessages = ar
130130
->method('getFallbackLocales')
131131
->will($this->returnValue(array('en')));
132132

133-
$extractor = $this->getMock('Symfony\Component\Translation\Extractor\ExtractorInterface');
133+
$extractor = $this->getMockBuilder('Symfony\Component\Translation\Extractor\ExtractorInterface')->getMock();
134134
$extractor
135135
->expects($this->any())
136136
->method('extract')
@@ -140,7 +140,7 @@ private function getContainer($extractedMessages = array(), $loadedMessages = ar
140140
})
141141
);
142142

143-
$loader = $this->getMock('Symfony\Bundle\FrameworkBundle\Translation\TranslationLoader');
143+
$loader = $this->getMockBuilder('Symfony\Bundle\FrameworkBundle\Translation\TranslationLoader')->getMock();
144144
$loader
145145
->expects($this->any())
146146
->method('loadMessages')
@@ -151,7 +151,7 @@ private function getContainer($extractedMessages = array(), $loadedMessages = ar
151151
);
152152

153153
if (null === $kernel) {
154-
$kernel = $this->getMock('Symfony\Component\HttpKernel\KernelInterface');
154+
$kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\KernelInterface')->getMock();
155155
$kernel
156156
->expects($this->any())
157157
->method('getBundle')
@@ -166,7 +166,7 @@ private function getContainer($extractedMessages = array(), $loadedMessages = ar
166166
->method('getRootDir')
167167
->will($this->returnValue($this->translationDir));
168168

169-
$container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface');
169+
$container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerInterface')->getMock();
170170
$container
171171
->expects($this->any())
172172
->method('get')
@@ -182,7 +182,7 @@ private function getContainer($extractedMessages = array(), $loadedMessages = ar
182182

183183
private function getBundle($path)
184184
{
185-
$bundle = $this->getMock('Symfony\Component\HttpKernel\Bundle\BundleInterface');
185+
$bundle = $this->getMockBuilder('Symfony\Component\HttpKernel\Bundle\BundleInterface')->getMock();
186186
$bundle
187187
->expects($this->any())
188188
->method('getPath')

Tests/Command/TranslationUpdateCommandTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ private function getContainer($extractedMessages = array(), $loadedMessages = ar
100100
->method('getFallbackLocales')
101101
->will($this->returnValue(array('en')));
102102

103-
$extractor = $this->getMock('Symfony\Component\Translation\Extractor\ExtractorInterface');
103+
$extractor = $this->getMockBuilder('Symfony\Component\Translation\Extractor\ExtractorInterface')->getMock();
104104
$extractor
105105
->expects($this->any())
106106
->method('extract')
@@ -112,7 +112,7 @@ private function getContainer($extractedMessages = array(), $loadedMessages = ar
112112
})
113113
);
114114

115-
$loader = $this->getMock('Symfony\Bundle\FrameworkBundle\Translation\TranslationLoader');
115+
$loader = $this->getMockBuilder('Symfony\Bundle\FrameworkBundle\Translation\TranslationLoader')->getMock();
116116
$loader
117117
->expects($this->any())
118118
->method('loadMessages')
@@ -122,7 +122,7 @@ private function getContainer($extractedMessages = array(), $loadedMessages = ar
122122
})
123123
);
124124

125-
$writer = $this->getMock('Symfony\Component\Translation\Writer\TranslationWriter');
125+
$writer = $this->getMockBuilder('Symfony\Component\Translation\Writer\TranslationWriter')->getMock();
126126
$writer
127127
->expects($this->any())
128128
->method('getFormats')
@@ -131,7 +131,7 @@ private function getContainer($extractedMessages = array(), $loadedMessages = ar
131131
);
132132

133133
if (null === $kernel) {
134-
$kernel = $this->getMock('Symfony\Component\HttpKernel\KernelInterface');
134+
$kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\KernelInterface')->getMock();
135135
$kernel
136136
->expects($this->any())
137137
->method('getBundle')
@@ -146,7 +146,7 @@ private function getContainer($extractedMessages = array(), $loadedMessages = ar
146146
->method('getRootDir')
147147
->will($this->returnValue($this->translationDir));
148148

149-
$container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface');
149+
$container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerInterface')->getMock();
150150
$container
151151
->expects($this->any())
152152
->method('get')
@@ -163,7 +163,7 @@ private function getContainer($extractedMessages = array(), $loadedMessages = ar
163163

164164
private function getBundle($path)
165165
{
166-
$bundle = $this->getMock('Symfony\Component\HttpKernel\Bundle\BundleInterface');
166+
$bundle = $this->getMockBuilder('Symfony\Component\HttpKernel\Bundle\BundleInterface')->getMock();
167167
$bundle
168168
->expects($this->any())
169169
->method('getPath')

Tests/Console/ApplicationTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class ApplicationTest extends TestCase
2222
{
2323
public function testBundleInterfaceImplementation()
2424
{
25-
$bundle = $this->getMock('Symfony\Component\HttpKernel\Bundle\BundleInterface');
25+
$bundle = $this->getMockBuilder('Symfony\Component\HttpKernel\Bundle\BundleInterface')->getMock();
2626

2727
$kernel = $this->getKernel(array($bundle), true);
2828

@@ -117,10 +117,10 @@ public function testBundleCommandsHaveRightContainer()
117117

118118
private function getKernel(array $bundles, $useDispatcher = false)
119119
{
120-
$container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface');
120+
$container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerInterface')->getMock();
121121

122122
if ($useDispatcher) {
123-
$dispatcher = $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface');
123+
$dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcherInterface')->getMock();
124124
$dispatcher
125125
->expects($this->atLeastOnce())
126126
->method('dispatch')
@@ -145,7 +145,7 @@ private function getKernel(array $bundles, $useDispatcher = false)
145145
->will($this->returnValue(array()))
146146
;
147147

148-
$kernel = $this->getMock('Symfony\Component\HttpKernel\KernelInterface');
148+
$kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\KernelInterface')->getMock();
149149
$kernel
150150
->expects($this->any())
151151
->method('getBundles')
@@ -162,7 +162,7 @@ private function getKernel(array $bundles, $useDispatcher = false)
162162

163163
private function createBundleMock(array $commands)
164164
{
165-
$bundle = $this->getMock('Symfony\Component\HttpKernel\Bundle\Bundle');
165+
$bundle = $this->getMockBuilder('Symfony\Component\HttpKernel\Bundle\Bundle')->getMock();
166166
$bundle
167167
->expects($this->once())
168168
->method('registerCommands')

Tests/Controller/ControllerNameParserTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ private function createParser()
147147
'FabpotFooBundle' => array($this->getBundle('TestBundle\Fabpot\FooBundle', 'FabpotFooBundle'), $this->getBundle('TestBundle\Sensio\FooBundle', 'SensioFooBundle')),
148148
);
149149

150-
$kernel = $this->getMock('Symfony\Component\HttpKernel\KernelInterface');
150+
$kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\KernelInterface')->getMock();
151151
$kernel
152152
->expects($this->any())
153153
->method('getBundle')
@@ -178,7 +178,7 @@ private function createParser()
178178

179179
private function getBundle($namespace, $name)
180180
{
181-
$bundle = $this->getMock('Symfony\Component\HttpKernel\Bundle\BundleInterface');
181+
$bundle = $this->getMockBuilder('Symfony\Component\HttpKernel\Bundle\BundleInterface')->getMock();
182182
$bundle->expects($this->any())->method('getName')->will($this->returnValue($name));
183183
$bundle->expects($this->any())->method('getNamespace')->will($this->returnValue($namespace));
184184

Tests/Controller/ControllerResolverTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,12 +179,12 @@ protected function createControllerResolver(LoggerInterface $logger = null, Cont
179179

180180
protected function createMockParser()
181181
{
182-
return $this->getMock('Symfony\Bundle\FrameworkBundle\Controller\ControllerNameParser', array(), array(), '', false);
182+
return $this->getMockBuilder('Symfony\Bundle\FrameworkBundle\Controller\ControllerNameParser')->disableOriginalConstructor()->getMock();
183183
}
184184

185185
protected function createMockContainer()
186186
{
187-
return $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface');
187+
return $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerInterface')->getMock();
188188
}
189189
}
190190

0 commit comments

Comments
 (0)