Exemplo n.º 1
0
 public function testFindMatched()
 {
     $request = new SampleRequest(['path' => '/sample-path']);
     $config = new RouteConfig();
     $config->request = $request;
     $config->path = '/sample-path';
     $config->methods = [Route::GET_METHOD];
     $route = new Route($config);
     $this->collection->add($route);
     $foundRoute = $this->collection->findMatched();
     $this->assertEquals($route, $foundRoute);
 }
Exemplo n.º 2
0
 public function execute()
 {
     try {
         $route = $this->routes->findMatched();
         $result = $route->getOperation();
         $result = $result->exec();
     } catch (ApiException $e) {
         $result = null;
         $error = new OutputError(__CLASS__, (string) $e);
         $this->output->addError($error);
     }
     return $this->output->execute($result);
 }