1818use Symfony \Component \HttpFoundation \RequestStack ;
1919use Symfony \Component \HttpFoundation \Response ;
2020use Symfony \Component \HttpFoundation \Session \Flash \FlashBag ;
21+ use Symfony \Component \HttpFoundation \StreamedResponse ;
22+ use Symfony \Component \Routing \Generator \UrlGeneratorInterface ;
2123use Symfony \Component \Security \Core \Authentication \Token \AnonymousToken ;
2224use Symfony \Component \Security \Core \Authentication \Token \UsernamePasswordToken ;
2325use Symfony \Component \Security \Core \User \User ;
@@ -270,15 +272,15 @@ public function testGenerateUrl()
270272 $ container = $ this ->getMock ('Symfony\Component\DependencyInjection\ContainerInterface ' );
271273 $ container ->expects ($ this ->at (0 ))->method ('get ' )->will ($ this ->returnValue ($ router ));
272274
273- $ controller = new Controller ();
275+ $ controller = new TestController ();
274276 $ controller ->setContainer ($ container );
275277
276278 $ this ->assertEquals ('/foo ' , $ controller ->generateUrl ('foo ' ));
277279 }
278280
279281 public function testRedirect ()
280282 {
281- $ controller = new Controller ();
283+ $ controller = new TestController ();
282284 $ response = $ controller ->redirect ('http://dunglas.fr ' , 301 );
283285
284286 $ this ->assertInstanceOf ('Symfony\Component\HttpFoundation\RedirectResponse ' , $ response );
@@ -295,7 +297,7 @@ public function testRenderViewTemplating()
295297 $ container ->expects ($ this ->at (0 ))->method ('has ' )->willReturn (true );
296298 $ container ->expects ($ this ->at (1 ))->method ('get ' )->will ($ this ->returnValue ($ templating ));
297299
298- $ controller = new Controller ();
300+ $ controller = new TestController ();
299301 $ controller ->setContainer ($ container );
300302
301303 $ this ->assertEquals ('bar ' , $ controller ->renderView ('foo ' ));
@@ -310,7 +312,7 @@ public function testRenderTemplating()
310312 $ container ->expects ($ this ->at (0 ))->method ('has ' )->willReturn (true );
311313 $ container ->expects ($ this ->at (1 ))->method ('get ' )->will ($ this ->returnValue ($ templating ));
312314
313- $ controller = new Controller ();
315+ $ controller = new TestController ();
314316 $ controller ->setContainer ($ container );
315317
316318 $ this ->assertEquals ('bar ' , $ controller ->render ('foo ' )->getContent ());
@@ -324,15 +326,15 @@ public function testStreamTemplating()
324326 $ container ->expects ($ this ->at (0 ))->method ('has ' )->willReturn (true );
325327 $ container ->expects ($ this ->at (1 ))->method ('get ' )->will ($ this ->returnValue ($ templating ));
326328
327- $ controller = new Controller ();
329+ $ controller = new TestController ();
328330 $ controller ->setContainer ($ container );
329331
330332 $ this ->assertInstanceOf ('Symfony\Component\HttpFoundation\StreamedResponse ' , $ controller ->stream ('foo ' ));
331333 }
332334
333335 public function testCreateNotFoundException ()
334336 {
335- $ controller = new Controller ();
337+ $ controller = new TestController ();
336338
337339 $ this ->assertInstanceOf ('Symfony\Component\HttpKernel\Exception\NotFoundHttpException ' , $ controller ->createNotFoundException ());
338340 }
@@ -347,7 +349,7 @@ public function testCreateForm()
347349 $ container = $ this ->getMock ('Symfony\Component\DependencyInjection\ContainerInterface ' );
348350 $ container ->expects ($ this ->at (0 ))->method ('get ' )->will ($ this ->returnValue ($ formFactory ));
349351
350- $ controller = new Controller ();
352+ $ controller = new TestController ();
351353 $ controller ->setContainer ($ container );
352354
353355 $ this ->assertEquals ($ form , $ controller ->createForm ('foo ' ));
@@ -363,7 +365,7 @@ public function testCreateFormBuilder()
363365 $ container = $ this ->getMock ('Symfony\Component\DependencyInjection\ContainerInterface ' );
364366 $ container ->expects ($ this ->at (0 ))->method ('get ' )->will ($ this ->returnValue ($ formFactory ));
365367
366- $ controller = new Controller ();
368+ $ controller = new TestController ();
367369 $ controller ->setContainer ($ container );
368370
369371 $ this ->assertEquals ($ formBuilder , $ controller ->createFormBuilder ('foo ' ));
@@ -377,7 +379,7 @@ public function testGetDoctrine()
377379 $ container ->expects ($ this ->at (0 ))->method ('has ' )->will ($ this ->returnValue (true ));
378380 $ container ->expects ($ this ->at (1 ))->method ('get ' )->will ($ this ->returnValue ($ doctrine ));
379381
380- $ controller = new Controller ();
382+ $ controller = new TestController ();
381383 $ controller ->setContainer ($ container );
382384
383385 $ this ->assertEquals ($ doctrine , $ controller ->getDoctrine ());
@@ -386,6 +388,16 @@ public function testGetDoctrine()
386388
387389class TestController extends Controller
388390{
391+ public function generateUrl ($ route , $ parameters = array (), $ referenceType = UrlGeneratorInterface::ABSOLUTE_PATH )
392+ {
393+ return parent ::generateUrl ($ route , $ parameters , $ referenceType );
394+ }
395+
396+ public function redirect ($ url , $ status = 302 )
397+ {
398+ return parent ::redirect ($ url , $ status );
399+ }
400+
389401 public function forward ($ controller , array $ path = array (), array $ query = array ())
390402 {
391403 return parent ::forward ($ controller , $ path , $ query );
@@ -420,4 +432,44 @@ public function isCsrfTokenValid($id, $token)
420432 {
421433 return parent ::isCsrfTokenValid ($ id , $ token );
422434 }
435+
436+ public function renderView ($ view , array $ parameters = array ())
437+ {
438+ return parent ::renderView ($ view , $ parameters );
439+ }
440+
441+ public function render ($ view , array $ parameters = array (), Response $ response = null )
442+ {
443+ return parent ::render ($ view , $ parameters , $ response );
444+ }
445+
446+ public function stream ($ view , array $ parameters = array (), StreamedResponse $ response = null )
447+ {
448+ return parent ::stream ($ view , $ parameters , $ response );
449+ }
450+
451+ public function createNotFoundException ($ message = 'Not Found ' , \Exception $ previous = null )
452+ {
453+ return parent ::createNotFoundException ($ message , $ previous );
454+ }
455+
456+ public function createAccessDeniedException ($ message = 'Access Denied. ' , \Exception $ previous = null )
457+ {
458+ return parent ::createAccessDeniedException ($ message , $ previous );
459+ }
460+
461+ public function createForm ($ type , $ data = null , array $ options = array ())
462+ {
463+ return parent ::createForm ($ type , $ data , $ options );
464+ }
465+
466+ public function createFormBuilder ($ data = null , array $ options = array ())
467+ {
468+ return parent ::createFormBuilder ($ data , $ options );
469+ }
470+
471+ public function getDoctrine ()
472+ {
473+ return parent ::getDoctrine ();
474+ }
423475}
0 commit comments