Commit f0124c7f authored by Marcin Chwedziak's avatar Marcin Chwedziak Committed by Fabien Potencier

Added support for URL host from Routing Component

parent 59e7dbd3
......@@ -86,6 +86,20 @@ class Route extends BaseRoute
return $this;
}
/**
* Sets the requirement of host on this Route
*
* @param string $host The host for which this route should be enabled
*
* @return Route $this The current Route instance
*/
public function host($host)
{
$this->setHost($host);
return $this;
}
/**
* Sets the requirement of HTTP (no HTTPS) on this Route.
*
......
......@@ -179,6 +179,14 @@ class RouterTest extends \PHPUnit_Framework_TestCase
$this->assertEquals('/foo/', $response->getTargetUrl());
}
public function testHostSpecification()
{
$route = new \Silex\Route();
$this->assertSame($route, $route->host('{locale}.example.com'));
$this->assertEquals('{locale}.example.com', $route->getHost());
}
public function testRequireHttpRedirect()
{
$app = new Application();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment