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());
 }
Example #2
0
 /**
  * @runInSeparateProcess
  */
 public function test_shutdown_with_response()
 {
     $app = new HttpApp();
     $app->shutdownWithResponse(new HttpResponse());
 }