* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Tests\Component\HttpKernel; use Symfony\Component\HttpKernel\HttpKernel; use Symfony\Component\HttpKernel\HttpKernelInterface; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\EventDispatcher\EventDispatcher; class HttpKernelTest extends \PHPUnit_Framework_TestCase { public function testHandleSetsTheRequest() { $request = Request::create('/'); $container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface'); $container->expects($this->exactly(1)) ->method('set') ->with('request', $request) ; $kernel = new HttpKernel($container, new EventDispatcher(), $this->getResolver()); $kernel->handle($request); } protected function getResolver($controller = null) { if (null === $controller) { $controller = function () { return new Response('Hello'); }; } $resolver = $this->getMock('Symfony\Component\HttpKernel\Controller\ControllerResolverInterface'); $resolver->expects($this->any()) ->method('getController') ->will($this->returnValue($controller)) ; $resolver->expects($this->any()) ->method('getArguments') ->will($this->returnValue(array())) ; return $resolver; } }