Example #1
0
 /**
  * @expectedException \RuntimeException
  */
 public function testNoGeneratedResponseForException()
 {
     $em = new EventManager();
     $em->addEventListener(KernelEvents::EXCEPTION, function (ExceptionEvent $event) {
         // do not generate a response!
     });
     $kernel = new HttpKernel($em, new ClosureControllerFactory());
     $kernel->handle(Request::create('GET', '/home'));
 }
Example #2
0
 public function testHandleRequest()
 {
     $dic = new ServiceLocator();
     $dic->register('http_kernel', function () {
         return new DummyHttpKernel();
     });
     $kernel = new Kernel($dic);
     $response = $kernel->handle(Request::create('GET', '/'));
     $this->assertInstanceOf(Response::class, $response);
     $this->assertSame('DUMMY!', $response->getBody());
 }