@@ -33,12 +33,12 @@ public function testForward()
33
33
$ requestStack = new RequestStack ();
34
34
$ requestStack ->push ($ request );
35
35
36
- $ kernel = $ this ->getMock ('Symfony\Component\HttpKernel\HttpKernelInterface ' );
36
+ $ kernel = $ this ->getMockBuilder ('Symfony\Component\HttpKernel\HttpKernelInterface ' )-> getMock ( );
37
37
$ kernel ->expects ($ this ->once ())->method ('handle ' )->will ($ this ->returnCallback (function (Request $ request ) {
38
38
return new Response ($ request ->getRequestFormat ().'-- ' .$ request ->getLocale ());
39
39
}));
40
40
41
- $ container = $ this ->getMock ('Symfony\Component\DependencyInjection\ContainerInterface ' );
41
+ $ container = $ this ->getMockBuilder ('Symfony\Component\DependencyInjection\ContainerInterface ' )-> getMock ( );
42
42
$ container ->expects ($ this ->at (0 ))->method ('get ' )->will ($ this ->returnValue ($ requestStack ));
43
43
$ container ->expects ($ this ->at (1 ))->method ('get ' )->will ($ this ->returnValue ($ kernel ));
44
44
@@ -84,7 +84,7 @@ public function testGetUserWithEmptyTokenStorage()
84
84
*/
85
85
public function testGetUserWithEmptyContainer ()
86
86
{
87
- $ container = $ this ->getMock ('Symfony\Component\DependencyInjection\ContainerInterface ' );
87
+ $ container = $ this ->getMockBuilder ('Symfony\Component\DependencyInjection\ContainerInterface ' )-> getMock ( );
88
88
$ container
89
89
->expects ($ this ->once ())
90
90
->method ('has ' )
@@ -104,13 +104,13 @@ public function testGetUserWithEmptyContainer()
104
104
*/
105
105
private function getContainerWithTokenStorage ($ token = null )
106
106
{
107
- $ tokenStorage = $ this ->getMock ('Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage ' );
107
+ $ tokenStorage = $ this ->getMockBuilder ('Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage ' )-> getMock ( );
108
108
$ tokenStorage
109
109
->expects ($ this ->once ())
110
110
->method ('getToken ' )
111
111
->will ($ this ->returnValue ($ token ));
112
112
113
- $ container = $ this ->getMock ('Symfony\Component\DependencyInjection\ContainerInterface ' );
113
+ $ container = $ this ->getMockBuilder ('Symfony\Component\DependencyInjection\ContainerInterface ' )-> getMock ( );
114
114
$ container
115
115
->expects ($ this ->once ())
116
116
->method ('has ' )
@@ -128,10 +128,10 @@ private function getContainerWithTokenStorage($token = null)
128
128
129
129
public function testIsGranted ()
130
130
{
131
- $ authorizationChecker = $ this ->getMock ('Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface ' );
131
+ $ authorizationChecker = $ this ->getMockBuilder ('Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface ' )-> getMock ( );
132
132
$ authorizationChecker ->expects ($ this ->once ())->method ('isGranted ' )->willReturn (true );
133
133
134
- $ container = $ this ->getMock ('Symfony\Component\DependencyInjection\ContainerInterface ' );
134
+ $ container = $ this ->getMockBuilder ('Symfony\Component\DependencyInjection\ContainerInterface ' )-> getMock ( );
135
135
$ container ->expects ($ this ->at (0 ))->method ('has ' )->will ($ this ->returnValue (true ));
136
136
$ container ->expects ($ this ->at (1 ))->method ('get ' )->will ($ this ->returnValue ($ authorizationChecker ));
137
137
@@ -146,10 +146,10 @@ public function testIsGranted()
146
146
*/
147
147
public function testdenyAccessUnlessGranted ()
148
148
{
149
- $ authorizationChecker = $ this ->getMock ('Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface ' );
149
+ $ authorizationChecker = $ this ->getMockBuilder ('Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface ' )-> getMock ( );
150
150
$ authorizationChecker ->expects ($ this ->once ())->method ('isGranted ' )->willReturn (false );
151
151
152
- $ container = $ this ->getMock ('Symfony\Component\DependencyInjection\ContainerInterface ' );
152
+ $ container = $ this ->getMockBuilder ('Symfony\Component\DependencyInjection\ContainerInterface ' )-> getMock ( );
153
153
$ container ->expects ($ this ->at (0 ))->method ('has ' )->will ($ this ->returnValue (true ));
154
154
$ container ->expects ($ this ->at (1 ))->method ('get ' )->will ($ this ->returnValue ($ authorizationChecker ));
155
155
@@ -164,7 +164,7 @@ public function testRenderViewTwig()
164
164
$ twig = $ this ->getMockBuilder ('\Twig_Environment ' )->disableOriginalConstructor ()->getMock ();
165
165
$ twig ->expects ($ this ->once ())->method ('render ' )->willReturn ('bar ' );
166
166
167
- $ container = $ this ->getMock ('Symfony\Component\DependencyInjection\ContainerInterface ' );
167
+ $ container = $ this ->getMockBuilder ('Symfony\Component\DependencyInjection\ContainerInterface ' )-> getMock ( );
168
168
$ container ->expects ($ this ->at (0 ))->method ('has ' )->will ($ this ->returnValue (false ));
169
169
$ container ->expects ($ this ->at (1 ))->method ('has ' )->will ($ this ->returnValue (true ));
170
170
$ container ->expects ($ this ->at (2 ))->method ('get ' )->will ($ this ->returnValue ($ twig ));
@@ -180,7 +180,7 @@ public function testRenderTwig()
180
180
$ twig = $ this ->getMockBuilder ('\Twig_Environment ' )->disableOriginalConstructor ()->getMock ();
181
181
$ twig ->expects ($ this ->once ())->method ('render ' )->willReturn ('bar ' );
182
182
183
- $ container = $ this ->getMock ('Symfony\Component\DependencyInjection\ContainerInterface ' );
183
+ $ container = $ this ->getMockBuilder ('Symfony\Component\DependencyInjection\ContainerInterface ' )-> getMock ( );
184
184
$ container ->expects ($ this ->at (0 ))->method ('has ' )->will ($ this ->returnValue (false ));
185
185
$ container ->expects ($ this ->at (1 ))->method ('has ' )->will ($ this ->returnValue (true ));
186
186
$ container ->expects ($ this ->at (2 ))->method ('get ' )->will ($ this ->returnValue ($ twig ));
@@ -195,7 +195,7 @@ public function testStreamTwig()
195
195
{
196
196
$ twig = $ this ->getMockBuilder ('\Twig_Environment ' )->disableOriginalConstructor ()->getMock ();
197
197
198
- $ container = $ this ->getMock ('Symfony\Component\DependencyInjection\ContainerInterface ' );
198
+ $ container = $ this ->getMockBuilder ('Symfony\Component\DependencyInjection\ContainerInterface ' )-> getMock ( );
199
199
$ container ->expects ($ this ->at (0 ))->method ('has ' )->will ($ this ->returnValue (false ));
200
200
$ container ->expects ($ this ->at (1 ))->method ('has ' )->will ($ this ->returnValue (true ));
201
201
$ container ->expects ($ this ->at (2 ))->method ('get ' )->will ($ this ->returnValue ($ twig ));
@@ -208,10 +208,10 @@ public function testStreamTwig()
208
208
209
209
public function testRedirectToRoute ()
210
210
{
211
- $ router = $ this ->getMock ('Symfony\Component\Routing\RouterInterface ' );
211
+ $ router = $ this ->getMockBuilder ('Symfony\Component\Routing\RouterInterface ' )-> getMock ( );
212
212
$ router ->expects ($ this ->once ())->method ('generate ' )->willReturn ('/foo ' );
213
213
214
- $ container = $ this ->getMock ('Symfony\Component\DependencyInjection\ContainerInterface ' );
214
+ $ container = $ this ->getMockBuilder ('Symfony\Component\DependencyInjection\ContainerInterface ' )-> getMock ( );
215
215
$ container ->expects ($ this ->at (0 ))->method ('get ' )->will ($ this ->returnValue ($ router ));
216
216
217
217
$ controller = new TestController ();
@@ -226,10 +226,10 @@ public function testRedirectToRoute()
226
226
public function testAddFlash ()
227
227
{
228
228
$ flashBag = new FlashBag ();
229
- $ session = $ this ->getMock ('Symfony\Component\HttpFoundation\Session\Session ' );
229
+ $ session = $ this ->getMockBuilder ('Symfony\Component\HttpFoundation\Session\Session ' )-> getMock ( );
230
230
$ session ->expects ($ this ->once ())->method ('getFlashBag ' )->willReturn ($ flashBag );
231
231
232
- $ container = $ this ->getMock ('Symfony\Component\DependencyInjection\ContainerInterface ' );
232
+ $ container = $ this ->getMockBuilder ('Symfony\Component\DependencyInjection\ContainerInterface ' )-> getMock ( );
233
233
$ container ->expects ($ this ->at (0 ))->method ('has ' )->will ($ this ->returnValue (true ));
234
234
$ container ->expects ($ this ->at (1 ))->method ('get ' )->will ($ this ->returnValue ($ session ));
235
235
@@ -249,10 +249,10 @@ public function testCreateAccessDeniedException()
249
249
250
250
public function testIsCsrfTokenValid ()
251
251
{
252
- $ tokenManager = $ this ->getMock ('Symfony\Component\Security\Csrf\CsrfTokenManagerInterface ' );
252
+ $ tokenManager = $ this ->getMockBuilder ('Symfony\Component\Security\Csrf\CsrfTokenManagerInterface ' )-> getMock ( );
253
253
$ tokenManager ->expects ($ this ->once ())->method ('isTokenValid ' )->willReturn (true );
254
254
255
- $ container = $ this ->getMock ('Symfony\Component\DependencyInjection\ContainerInterface ' );
255
+ $ container = $ this ->getMockBuilder ('Symfony\Component\DependencyInjection\ContainerInterface ' )-> getMock ( );
256
256
$ container ->expects ($ this ->at (0 ))->method ('has ' )->will ($ this ->returnValue (true ));
257
257
$ container ->expects ($ this ->at (1 ))->method ('get ' )->will ($ this ->returnValue ($ tokenManager ));
258
258
@@ -264,10 +264,10 @@ public function testIsCsrfTokenValid()
264
264
265
265
public function testGenerateUrl ()
266
266
{
267
- $ router = $ this ->getMock ('Symfony\Component\Routing\RouterInterface ' );
267
+ $ router = $ this ->getMockBuilder ('Symfony\Component\Routing\RouterInterface ' )-> getMock ( );
268
268
$ router ->expects ($ this ->once ())->method ('generate ' )->willReturn ('/foo ' );
269
269
270
- $ container = $ this ->getMock ('Symfony\Component\DependencyInjection\ContainerInterface ' );
270
+ $ container = $ this ->getMockBuilder ('Symfony\Component\DependencyInjection\ContainerInterface ' )-> getMock ( );
271
271
$ container ->expects ($ this ->at (0 ))->method ('get ' )->will ($ this ->returnValue ($ router ));
272
272
273
273
$ controller = new Controller ();
@@ -288,10 +288,10 @@ public function testRedirect()
288
288
289
289
public function testRenderViewTemplating ()
290
290
{
291
- $ templating = $ this ->getMock ('Symfony\Bundle\FrameworkBundle\Templating\EngineInterface ' );
291
+ $ templating = $ this ->getMockBuilder ('Symfony\Bundle\FrameworkBundle\Templating\EngineInterface ' )-> getMock ( );
292
292
$ templating ->expects ($ this ->once ())->method ('render ' )->willReturn ('bar ' );
293
293
294
- $ container = $ this ->getMock ('Symfony\Component\DependencyInjection\ContainerInterface ' );
294
+ $ container = $ this ->getMockBuilder ('Symfony\Component\DependencyInjection\ContainerInterface ' )-> getMock ( );
295
295
$ container ->expects ($ this ->at (0 ))->method ('has ' )->willReturn (true );
296
296
$ container ->expects ($ this ->at (1 ))->method ('get ' )->will ($ this ->returnValue ($ templating ));
297
297
@@ -303,10 +303,10 @@ public function testRenderViewTemplating()
303
303
304
304
public function testRenderTemplating ()
305
305
{
306
- $ templating = $ this ->getMock ('Symfony\Bundle\FrameworkBundle\Templating\EngineInterface ' );
306
+ $ templating = $ this ->getMockBuilder ('Symfony\Bundle\FrameworkBundle\Templating\EngineInterface ' )-> getMock ( );
307
307
$ templating ->expects ($ this ->once ())->method ('renderResponse ' )->willReturn (new Response ('bar ' ));
308
308
309
- $ container = $ this ->getMock ('Symfony\Component\DependencyInjection\ContainerInterface ' );
309
+ $ container = $ this ->getMockBuilder ('Symfony\Component\DependencyInjection\ContainerInterface ' )-> getMock ( );
310
310
$ container ->expects ($ this ->at (0 ))->method ('has ' )->willReturn (true );
311
311
$ container ->expects ($ this ->at (1 ))->method ('get ' )->will ($ this ->returnValue ($ templating ));
312
312
@@ -318,9 +318,9 @@ public function testRenderTemplating()
318
318
319
319
public function testStreamTemplating ()
320
320
{
321
- $ templating = $ this ->getMock ('Symfony\Component\Routing\RouterInterface ' );
321
+ $ templating = $ this ->getMockBuilder ('Symfony\Component\Routing\RouterInterface ' )-> getMock ( );
322
322
323
- $ container = $ this ->getMock ('Symfony\Component\DependencyInjection\ContainerInterface ' );
323
+ $ container = $ this ->getMockBuilder ('Symfony\Component\DependencyInjection\ContainerInterface ' )-> getMock ( );
324
324
$ container ->expects ($ this ->at (0 ))->method ('has ' )->willReturn (true );
325
325
$ container ->expects ($ this ->at (1 ))->method ('get ' )->will ($ this ->returnValue ($ templating ));
326
326
@@ -339,12 +339,12 @@ public function testCreateNotFoundException()
339
339
340
340
public function testCreateForm ()
341
341
{
342
- $ form = $ this ->getMock ('Symfony\Component\Form\FormInterface ' );
342
+ $ form = $ this ->getMockBuilder ('Symfony\Component\Form\FormInterface ' )-> getMock ( );
343
343
344
- $ formFactory = $ this ->getMock ('Symfony\Component\Form\FormFactoryInterface ' );
344
+ $ formFactory = $ this ->getMockBuilder ('Symfony\Component\Form\FormFactoryInterface ' )-> getMock ( );
345
345
$ formFactory ->expects ($ this ->once ())->method ('create ' )->willReturn ($ form );
346
346
347
- $ container = $ this ->getMock ('Symfony\Component\DependencyInjection\ContainerInterface ' );
347
+ $ container = $ this ->getMockBuilder ('Symfony\Component\DependencyInjection\ContainerInterface ' )-> getMock ( );
348
348
$ container ->expects ($ this ->at (0 ))->method ('get ' )->will ($ this ->returnValue ($ formFactory ));
349
349
350
350
$ controller = new Controller ();
@@ -355,12 +355,12 @@ public function testCreateForm()
355
355
356
356
public function testCreateFormBuilder ()
357
357
{
358
- $ formBuilder = $ this ->getMock ('Symfony\Component\Form\FormBuilderInterface ' );
358
+ $ formBuilder = $ this ->getMockBuilder ('Symfony\Component\Form\FormBuilderInterface ' )-> getMock ( );
359
359
360
- $ formFactory = $ this ->getMock ('Symfony\Component\Form\FormFactoryInterface ' );
360
+ $ formFactory = $ this ->getMockBuilder ('Symfony\Component\Form\FormFactoryInterface ' )-> getMock ( );
361
361
$ formFactory ->expects ($ this ->once ())->method ('createBuilder ' )->willReturn ($ formBuilder );
362
362
363
- $ container = $ this ->getMock ('Symfony\Component\DependencyInjection\ContainerInterface ' );
363
+ $ container = $ this ->getMockBuilder ('Symfony\Component\DependencyInjection\ContainerInterface ' )-> getMock ( );
364
364
$ container ->expects ($ this ->at (0 ))->method ('get ' )->will ($ this ->returnValue ($ formFactory ));
365
365
366
366
$ controller = new Controller ();
@@ -371,9 +371,9 @@ public function testCreateFormBuilder()
371
371
372
372
public function testGetDoctrine ()
373
373
{
374
- $ doctrine = $ this ->getMock ('Doctrine\Common\Persistence\ManagerRegistry ' );
374
+ $ doctrine = $ this ->getMockBuilder ('Doctrine\Common\Persistence\ManagerRegistry ' )-> getMock ( );
375
375
376
- $ container = $ this ->getMock ('Symfony\Component\DependencyInjection\ContainerInterface ' );
376
+ $ container = $ this ->getMockBuilder ('Symfony\Component\DependencyInjection\ContainerInterface ' )-> getMock ( );
377
377
$ container ->expects ($ this ->at (0 ))->method ('has ' )->will ($ this ->returnValue (true ));
378
378
$ container ->expects ($ this ->at (1 ))->method ('get ' )->will ($ this ->returnValue ($ doctrine ));
379
379
0 commit comments