Пример #1
0
 public function testAddingMiddleware()
 {
     $this->router->add(function ($req, $res, $next) {
         $res->write('add');
         return $next($req, $res);
     });
     $request = $this->newTonisRequest('/');
     $response = $this->newTonisResponse();
     $result = $this->router->__invoke($request, $response);
     $this->assertSame('add', $result->getBody()->__toString());
 }
Пример #2
0
 /**
  * Proxies to MiddlewarePipe::pipe.
  *
  * @param string $path
  * @param callable $handler
  */
 public function add($path, $handler = null)
 {
     $this->router->add($path, $handler);
 }