TestHttpKernel.php 1.1KB

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\Tests\Component\HttpKernel;
  11. use Symfony\Component\HttpKernel\HttpKernel;
  12. use Symfony\Component\HttpFoundation\Request;
  13. use Symfony\Component\HttpFoundation\Response;
  14. use Symfony\Component\HttpKernel\Controller\ControllerResolverInterface;
  15. use Symfony\Component\EventDispatcher\EventDispatcher;
  16. class TestHttpKernel extends HttpKernel implements ControllerResolverInterface
  17. {
  18. public function __construct()
  19. {
  20. parent::__construct(new EventDispatcher(), $this);
  21. }
  22. public function getController(Request $request)
  23. {
  24. return array($this, 'callController');
  25. }
  26. public function getArguments(Request $request, $controller)
  27. {
  28. return array($request);
  29. }
  30. public function callController(Request $request)
  31. {
  32. return new Response('Request: '.$request->getRequestUri());
  33. }
  34. }