|
12 | 12 | namespace Symfony\Bundle\FrameworkBundle\Tests\Controller;
|
13 | 13 |
|
14 | 14 | use Symfony\Bundle\FrameworkBundle\Tests\TestCase;
|
| 15 | +use Symfony\Bundle\FrameworkBundle\Controller\ControllerTrait; |
15 | 16 | use Symfony\Component\DependencyInjection\Container;
|
16 | 17 | use Symfony\Component\HttpFoundation\BinaryFileResponse;
|
17 | 18 | use Symfony\Component\HttpFoundation\File\File;
|
|
21 | 22 | use Symfony\Component\HttpFoundation\Response;
|
22 | 23 | use Symfony\Component\HttpFoundation\ResponseHeaderBag;
|
23 | 24 | use Symfony\Component\HttpFoundation\Session\Flash\FlashBag;
|
24 |
| -use Symfony\Component\HttpFoundation\StreamedResponse; |
25 |
| -use Symfony\Component\Routing\Generator\UrlGeneratorInterface; |
26 | 25 | use Symfony\Component\Security\Core\Authentication\Token\AnonymousToken;
|
27 | 26 | use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken;
|
28 | 27 | use Symfony\Component\Security\Core\User\User;
|
@@ -533,98 +532,25 @@ public function testGetDoctrine()
|
533 | 532 |
|
534 | 533 | trait TestControllerTrait
|
535 | 534 | {
|
536 |
| - public function generateUrl($route, $parameters = array(), $referenceType = UrlGeneratorInterface::ABSOLUTE_PATH) |
537 |
| - { |
538 |
| - return parent::generateUrl($route, $parameters, $referenceType); |
539 |
| - } |
540 |
| - |
541 |
| - public function redirect($url, $status = 302) |
542 |
| - { |
543 |
| - return parent::redirect($url, $status); |
544 |
| - } |
545 |
| - |
546 |
| - public function forward($controller, array $path = array(), array $query = array()) |
547 |
| - { |
548 |
| - return parent::forward($controller, $path, $query); |
549 |
| - } |
550 |
| - |
551 |
| - public function getUser() |
552 |
| - { |
553 |
| - return parent::getUser(); |
554 |
| - } |
555 |
| - |
556 |
| - public function json($data, $status = 200, $headers = array(), $context = array()) |
557 |
| - { |
558 |
| - return parent::json($data, $status, $headers, $context); |
559 |
| - } |
560 |
| - |
561 |
| - public function file($file, $fileName = null, $disposition = ResponseHeaderBag::DISPOSITION_ATTACHMENT) |
562 |
| - { |
563 |
| - return parent::file($file, $fileName, $disposition); |
564 |
| - } |
565 |
| - |
566 |
| - public function isGranted($attributes, $object = null) |
567 |
| - { |
568 |
| - return parent::isGranted($attributes, $object); |
569 |
| - } |
570 |
| - |
571 |
| - public function denyAccessUnlessGranted($attributes, $object = null, $message = 'Access Denied.') |
572 |
| - { |
573 |
| - parent::denyAccessUnlessGranted($attributes, $object, $message); |
574 |
| - } |
575 |
| - |
576 |
| - public function redirectToRoute($route, array $parameters = array(), $status = 302) |
577 |
| - { |
578 |
| - return parent::redirectToRoute($route, $parameters, $status); |
579 |
| - } |
580 |
| - |
581 |
| - public function addFlash($type, $message) |
582 |
| - { |
583 |
| - parent::addFlash($type, $message); |
584 |
| - } |
585 |
| - |
586 |
| - public function isCsrfTokenValid($id, $token) |
587 |
| - { |
588 |
| - return parent::isCsrfTokenValid($id, $token); |
589 |
| - } |
590 |
| - |
591 |
| - public function renderView($view, array $parameters = array()) |
592 |
| - { |
593 |
| - return parent::renderView($view, $parameters); |
594 |
| - } |
595 |
| - |
596 |
| - public function render($view, array $parameters = array(), Response $response = null) |
597 |
| - { |
598 |
| - return parent::render($view, $parameters, $response); |
599 |
| - } |
600 |
| - |
601 |
| - public function stream($view, array $parameters = array(), StreamedResponse $response = null) |
602 |
| - { |
603 |
| - return parent::stream($view, $parameters, $response); |
604 |
| - } |
605 |
| - |
606 |
| - public function createNotFoundException($message = 'Not Found', \Exception $previous = null) |
607 |
| - { |
608 |
| - return parent::createNotFoundException($message, $previous); |
609 |
| - } |
610 |
| - |
611 |
| - public function createAccessDeniedException($message = 'Access Denied.', \Exception $previous = null) |
612 |
| - { |
613 |
| - return parent::createAccessDeniedException($message, $previous); |
614 |
| - } |
615 |
| - |
616 |
| - public function createForm($type, $data = null, array $options = array()) |
617 |
| - { |
618 |
| - return parent::createForm($type, $data, $options); |
619 |
| - } |
620 |
| - |
621 |
| - public function createFormBuilder($data = null, array $options = array()) |
622 |
| - { |
623 |
| - return parent::createFormBuilder($data, $options); |
624 |
| - } |
625 |
| - |
626 |
| - public function getDoctrine() |
627 |
| - { |
628 |
| - return parent::getDoctrine(); |
| 535 | + use ControllerTrait { |
| 536 | + generateUrl as public; |
| 537 | + redirect as public; |
| 538 | + forward as public; |
| 539 | + getUser as public; |
| 540 | + json as public; |
| 541 | + file as public; |
| 542 | + isGranted as public; |
| 543 | + denyAccessUnlessGranted as public; |
| 544 | + redirectToRoute as public; |
| 545 | + addFlash as public; |
| 546 | + isCsrfTokenValid as public; |
| 547 | + renderView as public; |
| 548 | + render as public; |
| 549 | + stream as public; |
| 550 | + createNotFoundException as public; |
| 551 | + createAccessDeniedException as public; |
| 552 | + createForm as public; |
| 553 | + createFormBuilder as public; |
| 554 | + getDoctrine as public; |
629 | 555 | }
|
630 | 556 | }
|
0 commit comments