public function test_app_rethrows_exceptions_that_are_not_http_responseable() { $app = new HttpApp(); $app->getKernel()->addProvider(RegularExceptionProvider::class); $this->setExpectedException(Exception::class, 'regular exception'); $response = $app->handleRequest(new HttpRequest()); }
public function test_create() { $app = new HttpApp(); $config = new Config(); $config->set('routing', ['routes' => [['method' => 'GET', 'path' => '/foo', 'action' => 'foo']]]); $app->getConfigLoader()->addConfig($config); $app->getKernel()->addProvider(RequestHandlerProvider::class); $app->handleRequest(new HttpRequest()); /** @var IRouter $router */ $router = $app->getContainer()->get(IRouter::class); $handler = $app->getContainer()->get(IRequestHandler::class); $routes = $router->getRoutes(); $this->assertEquals(1, count($routes)); $route = $routes[0]; $this->assertEquals(['GET'], $route->getMethods()); $this->assertEquals('/foo', $route->getPath()); $this->assertEquals('foo', $route->getAction()); }