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()); }
/** * Proxies to MiddlewarePipe::pipe. * * @param string $path * @param callable $handler */ public function add($path, $handler = null) { $this->router->add($path, $handler); }