TestHttpKernel.php 1.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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\HttpKernel\Controller\ArgumentResolverInterface;
  12. use Symfony\Component\HttpKernel\HttpKernel;
  13. use Symfony\Component\HttpFoundation\Request;
  14. use Symfony\Component\HttpFoundation\Response;
  15. use Symfony\Component\HttpKernel\Controller\ControllerResolverInterface;
  16. use Symfony\Component\EventDispatcher\EventDispatcher;
  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 array($this, 'callController');
  26. }
  27. public function getArguments(Request $request, $controller)
  28. {
  29. return array($request);
  30. }
  31. public function callController(Request $request)
  32. {
  33. return new Response('Request: '.$request->getRequestUri());
  34. }
  35. }