TestHttpKernel.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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\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. }