/** * @param string|string[] $methods * @param string $path * @param callable $handler * @return Route */ public function route($methods, $path, $handler) { $route = $this->routeMap->add($path, $handler); $this->collector->addRoute($methods, $path, $route); $this->middleware[] = $route; return $route; }
public function testInvoke() { $map = new RouteMap(); $map->add('/foo/{id}', function () { })->name('foo'); $url = new UrlFunction($map); $this->assertSame('/foo/1234', $url('foo', ['id' => 1234])); }