public function testConstructor() { $route =
new Route('/{foo}',
['foo' => 'bar'
],
['foo' => '\d+'
],
['foo' => 'bar'
], '{locale}.example.com'
);
$this->
assertEquals('/{foo}',
$route->
getPath(), '__construct() takes a path as its first argument'
);
$this->
assertEquals(['foo' => 'bar'
],
$route->
getDefaults(), '__construct() takes defaults as its second argument'
);
$this->
assertEquals(['foo' => '\d+'
],
$route->
getRequirements(), '__construct() takes requirements as its third argument'
);
$this->
assertEquals('bar',
$route->
getOption('foo'
), '__construct() takes options as its fourth argument'
);
$this->
assertEquals('{locale}.example.com',
$route->
getHost(), '__construct() takes a host pattern as its fifth argument'
);
$route =
new Route('/',
[],
[],
[], '',
['Https'
],
['POST', 'put'
], 'context.getMethod() == "GET"'
);
$this->
assertEquals(['https'
],
$route->
getSchemes(), '__construct() takes schemes as its sixth argument and lowercases it'
);
$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}'
);