Example #1
0
 public function testRelativePathFor()
 {
     $this->router->setBasePath('/base/path');
     $methods = ['GET'];
     $pattern = '/hello/{first:\\w+}/{last}';
     $callable = function ($request, $response, $args) {
         echo sprintf('Hello %s %s', $args['first'], $args['last']);
     };
     $route = $this->router->map($methods, $pattern, $callable);
     $route->setName('foo');
     $this->assertEquals('/hello/josh/lockhart', $this->router->relativePathFor('foo', ['first' => 'josh', 'last' => 'lockhart']));
 }