TestHttpKernel.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Component\HttpKernel\Tests;
  11. use Symfony\Component\EventDispatcher\EventDispatcher;
  12. use Symfony\Component\HttpFoundation\Request;
  13. use Symfony\Component\HttpFoundation\Response;
  14. use Symfony\Component\HttpKernel\Controller\ArgumentResolverInterface;
  15. use Symfony\Component\HttpKernel\Controller\ControllerResolverInterface;
  16. use Symfony\Component\HttpKernel\HttpKernel;
  17. class TestHttpKernel extends HttpKernel implements ControllerResolverInterface, ArgumentResolverInterface
  18. {
  19. public function __construct()
  20. {
  21. parent::__construct(new EventDispatcher(), $this, null, $this);
  22. }
  23. public function getController(Request $request)
  24. {
  25. return [$this, 'callController'];
  26. }
  27. public function getArguments(Request $request, $controller)
  28. {
  29. return [$request];
  30. }
  31. public function callController(Request $request)
  32. {
  33. return new Response('Request: '.$request->getRequestUri());
  34. }
  35. }