$this->
assertEquals(['POST', 'PUT'
],
$route->
getMethods(), '__construct() takes methods as its seventh argument and uppercases it'
);
$this->
assertEquals('context.getMethod() == "GET"',
$route->
getCondition(), '__construct() takes a condition as its eight argument'
);
$route =
new Route('/',
[],
[],
[], '', 'Https', 'Post'
);
$this->
assertEquals(['https'
],
$route->
getSchemes(), '__construct() takes a single scheme as its sixth argument'
);
$this->
assertEquals(['POST'
],
$route->
getMethods(), '__construct() takes a single method as its seventh argument'
);
} public function testPath() { $route =
new Route('/{foo}'
);
$route->
setPath('/{bar}'
);
$this->
assertEquals('/{bar}',
$route->
getPath(), '->setPath() sets the path'
);
$route->
setPath(''
);
$this->
assertEquals('/',
$route->
getPath(), '->setPath() adds a / at the beginning of the path if needed'
);
$route->
setPath('bar'
);
$this->
assertEquals('/bar',
$route->
getPath(), '->setPath() adds a / at the beginning of the path if needed'
);
$this->
assertEquals($route,
$route->
setPath(''
), '->setPath() implements a fluent interface'
);
$route->
setPath('//path'
);
$this->
assertEquals('/path',
$route->
getPath(), '->setPath() does not allow two slashes "//" at the beginning of the path as it would be confused with a network path when generating the path from the route'
);
$route->
setPath('/path/{!foo}'
);
$this->
assertEquals('/path/{!foo}',
$route->
getPath(), '->setPath() keeps ! to pass important params'
);
$route->
setPath('/path/{bar<\w++>}'
);