Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Sign in
Toggle navigation
S
Silex
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
common
Silex
Commits
f0124c7f
Commit
f0124c7f
authored
Mar 08, 2013
by
Marcin Chwedziak
Committed by
Fabien Potencier
Apr 01, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added support for URL host from Routing Component
parent
59e7dbd3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
0 deletions
+22
-0
src/Silex/Route.php
src/Silex/Route.php
+14
-0
tests/Silex/Tests/RouterTest.php
tests/Silex/Tests/RouterTest.php
+8
-0
No files found.
src/Silex/Route.php
View file @
f0124c7f
...
...
@@ -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.
*
...
...
tests/Silex/Tests/RouterTest.php
View file @
f0124c7f
...
...
@@ -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
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment