diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/RouterDebugCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/RouterDebugCommand.php index fa3e681b89..b702ae2859 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/RouterDebugCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/RouterDebugCommand.php @@ -92,7 +92,7 @@ EOF ? implode(', ', $requirements['_method']) : $requirements['_method'] ) : 'ANY'; - $hostname = '' !== $route->getHostnamePattern() ? $route->getHostnamePattern() : 'ANY'; + $hostname = '' !== $route->getHostname() ? $route->getHostname() : 'ANY'; $maxName = max($maxName, strlen($name)); $maxMethod = max($maxMethod, strlen($method)); $maxHostname = max($maxHostname, strlen($hostname)); @@ -109,7 +109,7 @@ EOF ? implode(', ', $requirements['_method']) : $requirements['_method'] ) : 'ANY'; - $hostname = '' !== $route->getHostnamePattern() ? $route->getHostnamePattern() : 'ANY'; + $hostname = '' !== $route->getHostname() ? $route->getHostname() : 'ANY'; $output->writeln(sprintf($format, $name, $method, $hostname, $route->getPattern())); } } @@ -124,14 +124,14 @@ EOF throw new \InvalidArgumentException(sprintf('The route "%s" does not exist.', $name)); } - $hostname = '' !== $route->getHostnamePattern() ? $route->getHostnamePattern() : 'ANY'; + $hostname = '' !== $route->getHostname() ? $route->getHostname() : 'ANY'; $output->writeln($this->getHelper('formatter')->formatSection('router', sprintf('Route "%s"', $name))); - $output->writeln(sprintf('Name %s', $name)); - $output->writeln(sprintf('Pattern %s', $route->getPattern())); - $output->writeln(sprintf('HostnamePattern %s', $hostname)); - $output->writeln(sprintf('Class %s', get_class($route))); + $output->writeln(sprintf('Name %s', $name)); + $output->writeln(sprintf('Pattern %s', $route->getPattern())); + $output->writeln(sprintf('Hostname %s', $hostname)); + $output->writeln(sprintf('Class %s', get_class($route))); $defaults = ''; $d = $route->getDefaults(); diff --git a/src/Symfony/Bundle/FrameworkBundle/Routing/Router.php b/src/Symfony/Bundle/FrameworkBundle/Routing/Router.php index 8620ef507a..4fc81b25ae 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Routing/Router.php +++ b/src/Symfony/Bundle/FrameworkBundle/Routing/Router.php @@ -78,7 +78,7 @@ class Router extends BaseRouter implements WarmableInterface * - the route defaults, * - the route requirements, * - the route pattern. - * - the route hostnamePattern. + * - the route hostname. * * @param RouteCollection $collection */ @@ -94,7 +94,7 @@ class Router extends BaseRouter implements WarmableInterface } $route->setPattern($this->resolve($route->getPattern())); - $route->setHostnamePattern($this->resolve($route->getHostnamePattern())); + $route->setHostname($this->resolve($route->getHostname())); } } diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Routing/RouterTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Routing/RouterTest.php index 59f4d061be..01dede8925 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Routing/RouterTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Routing/RouterTest.php @@ -117,12 +117,12 @@ class RoutingTest extends \PHPUnit_Framework_TestCase ); } - public function testHostnamePatternPlaceholders() + public function testHostnamePlaceholders() { $routes = new RouteCollection(); $route = new Route('foo'); - $route->setHostnamePattern('/before/%parameter.foo%/after/%%unescaped%%'); + $route->setHostname('/before/%parameter.foo%/after/%%unescaped%%'); $routes->add('foo', $route); @@ -136,7 +136,7 @@ class RoutingTest extends \PHPUnit_Framework_TestCase $this->assertEquals( '/before/foo/after/%unescaped%', - $route->getHostnamePattern() + $route->getHostname() ); } diff --git a/src/Symfony/Component/Routing/Annotation/Route.php b/src/Symfony/Component/Routing/Annotation/Route.php index e593f97ff6..5fc98c9a6b 100644 --- a/src/Symfony/Component/Routing/Annotation/Route.php +++ b/src/Symfony/Component/Routing/Annotation/Route.php @@ -25,7 +25,7 @@ class Route private $requirements; private $options; private $defaults; - private $hostnamePattern; + private $hostname; /** * Constructor. @@ -62,14 +62,14 @@ class Route return $this->pattern; } - public function setHostnamePattern($pattern) + public function setHostname($pattern) { - $this->hostnamePattern = $pattern; + $this->hostname = $pattern; } - public function getHostnamePattern() + public function getHostname() { - return $this->hostnamePattern; + return $this->hostname; } public function setName($name) diff --git a/src/Symfony/Component/Routing/Loader/AnnotationClassLoader.php b/src/Symfony/Component/Routing/Loader/AnnotationClassLoader.php index 9b628d6658..46a5cf340c 100644 --- a/src/Symfony/Component/Routing/Loader/AnnotationClassLoader.php +++ b/src/Symfony/Component/Routing/Loader/AnnotationClassLoader.php @@ -108,11 +108,11 @@ abstract class AnnotationClassLoader implements LoaderInterface } $globals = array( - 'pattern' => '', - 'requirements' => array(), - 'options' => array(), - 'defaults' => array(), - 'hostname_pattern' => '', + 'pattern' => '', + 'requirements' => array(), + 'options' => array(), + 'defaults' => array(), + 'hostname' => '', ); $class = new \ReflectionClass($class); @@ -137,8 +137,8 @@ abstract class AnnotationClassLoader implements LoaderInterface $globals['defaults'] = $annot->getDefaults(); } - if (null !== $annot->getHostnamePattern()) { - $globals['hostname_pattern'] = $annot->getHostnamePattern(); + if (null !== $annot->getHostname()) { + $globals['hostname'] = $annot->getHostname(); } } @@ -173,12 +173,12 @@ abstract class AnnotationClassLoader implements LoaderInterface $requirements = array_replace($globals['requirements'], $annot->getRequirements()); $options = array_replace($globals['options'], $annot->getOptions()); - $hostnamePattern = $annot->getHostnamePattern(); - if (null === $hostnamePattern) { - $hostnamePattern = $globals['hostname_pattern']; + $hostname = $annot->getHostname(); + if (null === $hostname) { + $hostname = $globals['hostname']; } - $route = new Route($globals['pattern'].$annot->getPattern(), $defaults, $requirements, $options, $hostnamePattern); + $route = new Route($globals['pattern'].$annot->getPattern(), $defaults, $requirements, $options, $hostname); $this->configureRoute($route, $class, $method, $annot); diff --git a/src/Symfony/Component/Routing/Loader/XmlFileLoader.php b/src/Symfony/Component/Routing/Loader/XmlFileLoader.php index 3dec419ef0..2042eb7b82 100644 --- a/src/Symfony/Component/Routing/Loader/XmlFileLoader.php +++ b/src/Symfony/Component/Routing/Loader/XmlFileLoader.php @@ -121,7 +121,7 @@ class XmlFileLoader extends FileLoader list($defaults, $requirements, $options) = $this->parseConfigs($node, $path); - $route = new Route($node->getAttribute('pattern'), $defaults, $requirements, $options, $node->getAttribute('hostname-pattern'), $schemes, $methods); + $route = new Route($node->getAttribute('pattern'), $defaults, $requirements, $options, $node->getAttribute('hostname'), $schemes, $methods); $collection->add($id, $route); } @@ -143,7 +143,7 @@ class XmlFileLoader extends FileLoader $type = $node->getAttribute('type'); $prefix = $node->getAttribute('prefix'); - $hostnamePattern = $node->hasAttribute('hostname-pattern') ? $node->getAttribute('hostname-pattern') : null; + $hostname = $node->hasAttribute('hostname') ? $node->getAttribute('hostname') : null; $schemes = $node->hasAttribute('schemes') ? array_filter(explode(' ', $node->getAttribute('schemes'))) : null; $methods = $node->hasAttribute('methods') ? array_filter(explode(' ', $node->getAttribute('methods'))) : null; @@ -154,8 +154,8 @@ class XmlFileLoader extends FileLoader $subCollection = $this->import($resource, ('' !== $type ? $type : null), false, $file); /* @var $subCollection RouteCollection */ $subCollection->addPrefix($prefix); - if (null !== $hostnamePattern) { - $subCollection->setHostnamePattern($hostnamePattern); + if (null !== $hostname) { + $subCollection->setHostname($hostname); } if (null !== $schemes) { $subCollection->setSchemes($schemes); diff --git a/src/Symfony/Component/Routing/Loader/YamlFileLoader.php b/src/Symfony/Component/Routing/Loader/YamlFileLoader.php index cfc2ac3701..89d3b2044b 100644 --- a/src/Symfony/Component/Routing/Loader/YamlFileLoader.php +++ b/src/Symfony/Component/Routing/Loader/YamlFileLoader.php @@ -28,7 +28,7 @@ use Symfony\Component\Config\Loader\FileLoader; class YamlFileLoader extends FileLoader { private static $availableKeys = array( - 'resource', 'type', 'prefix', 'pattern', 'hostname_pattern', 'schemes', 'methods', 'defaults', 'requirements', 'options', + 'resource', 'type', 'prefix', 'pattern', 'hostname', 'schemes', 'methods', 'defaults', 'requirements', 'options', ); /** @@ -98,11 +98,11 @@ class YamlFileLoader extends FileLoader $defaults = isset($config['defaults']) ? $config['defaults'] : array(); $requirements = isset($config['requirements']) ? $config['requirements'] : array(); $options = isset($config['options']) ? $config['options'] : array(); - $hostnamePattern = isset($config['hostname_pattern']) ? $config['hostname_pattern'] : ''; + $hostname = isset($config['hostname']) ? $config['hostname'] : ''; $schemes = isset($config['schemes']) ? $config['schemes'] : array(); $methods = isset($config['methods']) ? $config['methods'] : array(); - $route = new Route($config['pattern'], $defaults, $requirements, $options, $hostnamePattern, $schemes, $methods); + $route = new Route($config['pattern'], $defaults, $requirements, $options, $hostname, $schemes, $methods); $collection->add($name, $route); } @@ -122,7 +122,7 @@ class YamlFileLoader extends FileLoader $defaults = isset($config['defaults']) ? $config['defaults'] : array(); $requirements = isset($config['requirements']) ? $config['requirements'] : array(); $options = isset($config['options']) ? $config['options'] : array(); - $hostnamePattern = isset($config['hostname_pattern']) ? $config['hostname_pattern'] : null; + $hostname = isset($config['hostname']) ? $config['hostname'] : null; $schemes = isset($config['schemes']) ? $config['schemes'] : null; $methods = isset($config['methods']) ? $config['methods'] : null; @@ -131,8 +131,8 @@ class YamlFileLoader extends FileLoader $subCollection = $this->import($config['resource'], $type, false, $file); /* @var $subCollection RouteCollection */ $subCollection->addPrefix($prefix); - if (null !== $hostnamePattern) { - $subCollection->setHostnamePattern($hostnamePattern); + if (null !== $hostname) { + $subCollection->setHostname($hostname); } if (null !== $schemes) { $subCollection->setSchemes($schemes); diff --git a/src/Symfony/Component/Routing/Loader/schema/routing/routing-1.0.xsd b/src/Symfony/Component/Routing/Loader/schema/routing/routing-1.0.xsd index 65f63f466e..8810585f7f 100644 --- a/src/Symfony/Component/Routing/Loader/schema/routing/routing-1.0.xsd +++ b/src/Symfony/Component/Routing/Loader/schema/routing/routing-1.0.xsd @@ -47,7 +47,7 @@ - + @@ -58,7 +58,7 @@ - + diff --git a/src/Symfony/Component/Routing/Route.php b/src/Symfony/Component/Routing/Route.php index 4f49352fa0..8c5bcab4ca 100644 --- a/src/Symfony/Component/Routing/Route.php +++ b/src/Symfony/Component/Routing/Route.php @@ -29,7 +29,7 @@ class Route implements \Serializable /** * @var string */ - private $hostnamePattern = ''; + private $hostname = ''; /** * @var array @@ -70,24 +70,23 @@ class Route implements \Serializable * * * compiler_class: A class name able to compile this route instance (RouteCompiler by default) * - * @param string $pattern The path pattern to match - * @param array $defaults An array of default parameter values - * @param array $requirements An array of requirements for parameters (regexes) - * @param array $options An array of options - * @param string $hostnamePattern The hostname pattern to match - * @param string|array $schemes A required URI scheme or an array of restricted schemes - * @param string|array $methods A required HTTP method or an array of restricted methods + * @param string $pattern The path pattern to match + * @param array $defaults An array of default parameter values + * @param array $requirements An array of requirements for parameters (regexes) + * @param array $options An array of options + * @param string $hostname The hostname pattern to match + * @param string|array $schemes A required URI scheme or an array of restricted schemes + * @param string|array $methods A required HTTP method or an array of restricted methods * * @api */ - public function __construct($pattern, array $defaults = array(), array $requirements = array(), array $options = array(), - $hostnamePattern = '', $schemes = array(), $methods = array()) + public function __construct($pattern, array $defaults = array(), array $requirements = array(), array $options = array(), $hostname = '', $schemes = array(), $methods = array()) { $this->setPattern($pattern); $this->setDefaults($defaults); $this->setRequirements($requirements); $this->setOptions($options); - $this->setHostnamePattern($hostnamePattern); + $this->setHostname($hostname); // The conditions make sure that an initial empty $schemes/$methods does not override the corresponding requirement. // They can be removed when the BC layer is removed. if ($schemes) { @@ -101,13 +100,13 @@ class Route implements \Serializable public function serialize() { return serialize(array( - 'pattern' => $this->pattern, - 'hostnamePattern' => $this->hostnamePattern, - 'defaults' => $this->defaults, + 'pattern' => $this->pattern, + 'hostname' => $this->hostname, + 'defaults' => $this->defaults, 'requirements' => $this->requirements, - 'options' => $this->options, - 'schemes' => $this->schemes, - 'methods' => $this->methods, + 'options' => $this->options, + 'schemes' => $this->schemes, + 'methods' => $this->methods, )); } @@ -115,7 +114,7 @@ class Route implements \Serializable { $data = unserialize($data); $this->pattern = $data['pattern']; - $this->hostnamePattern = $data['hostnamePattern']; + $this->hostname = $data['hostname']; $this->defaults = $data['defaults']; $this->requirements = $data['requirements']; $this->options = $data['options']; @@ -157,9 +156,9 @@ class Route implements \Serializable * * @return string The pattern */ - public function getHostnamePattern() + public function getHostname() { - return $this->hostnamePattern; + return $this->hostname; } /** @@ -167,9 +166,9 @@ class Route implements \Serializable * * @param string $pattern The pattern */ - public function setHostnamePattern($pattern) + public function setHostname($pattern) { - $this->hostnamePattern = (string) $pattern; + $this->hostname = (string) $pattern; $this->compiled = null; return $this; diff --git a/src/Symfony/Component/Routing/RouteCollection.php b/src/Symfony/Component/Routing/RouteCollection.php index af14134c65..a2a41d99d3 100644 --- a/src/Symfony/Component/Routing/RouteCollection.php +++ b/src/Symfony/Component/Routing/RouteCollection.php @@ -261,10 +261,10 @@ class RouteCollection implements \IteratorAggregate, \Countable * @param array $defaults An array of default values * @param array $requirements An array of requirements */ - public function setHostnamePattern($pattern, array $defaults = array(), array $requirements = array()) + public function setHostname($pattern, array $defaults = array(), array $requirements = array()) { foreach ($this->routes as $route) { - $route->setHostnamePattern($pattern); + $route->setHostname($pattern); $route->addDefaults($defaults); $route->addRequirements($requirements); } diff --git a/src/Symfony/Component/Routing/RouteCompiler.php b/src/Symfony/Component/Routing/RouteCompiler.php index 991ce0985b..f4459a0d74 100644 --- a/src/Symfony/Component/Routing/RouteCompiler.php +++ b/src/Symfony/Component/Routing/RouteCompiler.php @@ -46,8 +46,8 @@ class RouteCompiler implements RouteCompilerInterface $hostnameRegex = null; $hostnameTokens = array(); - if ('' !== $hostnamePattern = $route->getHostnamePattern()) { - $result = $this->compilePattern($route, $hostnamePattern, true); + if ('' !== $hostname = $route->getHostname()) { + $result = $this->compilePattern($route, $hostname, true); $hostnameVariables = $result['variables']; $variables = array_merge($variables, $hostnameVariables); diff --git a/src/Symfony/Component/Routing/Tests/Annotation/RouteTest.php b/src/Symfony/Component/Routing/Tests/Annotation/RouteTest.php index e1da002700..fc2e9433e6 100644 --- a/src/Symfony/Component/Routing/Tests/Annotation/RouteTest.php +++ b/src/Symfony/Component/Routing/Tests/Annotation/RouteTest.php @@ -40,7 +40,7 @@ class RouteTest extends \PHPUnit_Framework_TestCase array('options', array('compiler_class' => 'RouteCompiler'), 'getOptions'), array('name', 'blog_index', 'getName'), array('defaults', array('_controller' => 'MyBlogBundle:Blog:index'), 'getDefaults'), - array('hostname_pattern', array('{locale}.example.com'), 'getHostnamePattern') + array('hostname', array('{locale}.example.com'), 'getHostname') ); } } diff --git a/src/Symfony/Component/Routing/Tests/Fixtures/namespaceprefix.xml b/src/Symfony/Component/Routing/Tests/Fixtures/namespaceprefix.xml index efc4da9b37..118cf70074 100644 --- a/src/Symfony/Component/Routing/Tests/Fixtures/namespaceprefix.xml +++ b/src/Symfony/Component/Routing/Tests/Fixtures/namespaceprefix.xml @@ -4,7 +4,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://symfony.com/schema/routing http://symfony.com/schema/routing/routing-1.0.xsd"> - + MyBundle:Blog:show \w+ en|fr|de diff --git a/src/Symfony/Component/Routing/Tests/Fixtures/validpattern.xml b/src/Symfony/Component/Routing/Tests/Fixtures/validpattern.xml index 079116399c..198d15d4b7 100644 --- a/src/Symfony/Component/Routing/Tests/Fixtures/validpattern.xml +++ b/src/Symfony/Component/Routing/Tests/Fixtures/validpattern.xml @@ -4,7 +4,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://symfony.com/schema/routing http://symfony.com/schema/routing/routing-1.0.xsd"> - + MyBundle:Blog:show GET \w+ diff --git a/src/Symfony/Component/Routing/Tests/Fixtures/validpattern.yml b/src/Symfony/Component/Routing/Tests/Fixtures/validpattern.yml index 8fad8a0923..4d9f1c474d 100644 --- a/src/Symfony/Component/Routing/Tests/Fixtures/validpattern.yml +++ b/src/Symfony/Component/Routing/Tests/Fixtures/validpattern.yml @@ -1,7 +1,7 @@ blog_show: - pattern: /blog/{slug} - defaults: { _controller: MyBlogBundle:Blog:show } - hostname_pattern: "{locale}.example.com" - requirements: { '_method': 'GET', 'locale': '\w+' } + pattern: /blog/{slug} + defaults: { _controller: MyBlogBundle:Blog:show } + hostname : "{locale}.example.com" + requirements: { '_method': 'GET', 'locale': '\w+' } options: compiler_class: RouteCompiler diff --git a/src/Symfony/Component/Routing/Tests/Fixtures/validresource.xml b/src/Symfony/Component/Routing/Tests/Fixtures/validresource.xml index b3747864fb..803d8f2eed 100644 --- a/src/Symfony/Component/Routing/Tests/Fixtures/validresource.xml +++ b/src/Symfony/Component/Routing/Tests/Fixtures/validresource.xml @@ -4,7 +4,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://symfony.com/schema/routing http://symfony.com/schema/routing/routing-1.0.xsd"> - + 123 \d+ diff --git a/src/Symfony/Component/Routing/Tests/Fixtures/validresource.yml b/src/Symfony/Component/Routing/Tests/Fixtures/validresource.yml index 35a45398ff..b1de7ebbfc 100644 --- a/src/Symfony/Component/Routing/Tests/Fixtures/validresource.yml +++ b/src/Symfony/Component/Routing/Tests/Fixtures/validresource.yml @@ -1,7 +1,7 @@ blog_show: - resource: validpattern.yml - prefix: /{foo} - defaults: { 'foo': '123' } - requirements: { 'foo': '\d+' } - options: { 'foo': 'bar' } - hostname_pattern: "{locale}.example.com" + resource: validpattern.yml + prefix: /{foo} + defaults: { 'foo': '123' } + requirements: { 'foo': '\d+' } + options: { 'foo': 'bar' } + hostname: "{locale}.example.com" diff --git a/src/Symfony/Component/Routing/Tests/Loader/PhpFileLoaderTest.php b/src/Symfony/Component/Routing/Tests/Loader/PhpFileLoaderTest.php index 3ff425d981..c5bf81ea25 100644 --- a/src/Symfony/Component/Routing/Tests/Loader/PhpFileLoaderTest.php +++ b/src/Symfony/Component/Routing/Tests/Loader/PhpFileLoaderTest.php @@ -46,7 +46,7 @@ class PhpFileLoaderTest extends \PHPUnit_Framework_TestCase $this->assertEquals('/blog/{slug}', $route->getPattern()); $this->assertEquals('MyBlogBundle:Blog:show', $route->getDefault('_controller')); $this->assertEquals('GET', $route->getRequirement('_method')); - $this->assertEquals('{locale}.example.com', $route->getHostnamePattern()); + $this->assertEquals('{locale}.example.com', $route->getHostname()); $this->assertEquals('RouteCompiler', $route->getOption('compiler_class')); } } diff --git a/src/Symfony/Component/Routing/Tests/Loader/XmlFileLoaderTest.php b/src/Symfony/Component/Routing/Tests/Loader/XmlFileLoaderTest.php index 17e33ef297..003069bec8 100644 --- a/src/Symfony/Component/Routing/Tests/Loader/XmlFileLoaderTest.php +++ b/src/Symfony/Component/Routing/Tests/Loader/XmlFileLoaderTest.php @@ -48,7 +48,7 @@ class XmlFileLoaderTest extends \PHPUnit_Framework_TestCase $this->assertEquals('MyBundle:Blog:show', $route->getDefault('_controller')); $this->assertEquals('GET', $route->getRequirement('_method')); $this->assertEquals('\w+', $route->getRequirement('locale')); - $this->assertEquals('{locale}.example.com', $route->getHostnamePattern()); + $this->assertEquals('{locale}.example.com', $route->getHostname()); $this->assertEquals('RouteCompiler', $route->getOption('compiler_class')); } @@ -63,7 +63,7 @@ class XmlFileLoaderTest extends \PHPUnit_Framework_TestCase $this->assertEquals('MyBundle:Blog:show', $route->getDefault('_controller')); $this->assertEquals('\w+', $route->getRequirement('slug')); $this->assertEquals('en|fr|de', $route->getRequirement('_locale')); - $this->assertEquals('{_locale}.example.com', $route->getHostnamePattern()); + $this->assertEquals('{_locale}.example.com', $route->getHostname()); $this->assertEquals('RouteCompiler', $route->getOption('compiler_class')); } @@ -80,7 +80,7 @@ class XmlFileLoaderTest extends \PHPUnit_Framework_TestCase $this->assertEquals('123', $routes['blog_show']->getDefault('foo')); $this->assertEquals('\d+', $routes['blog_show']->getRequirement('foo')); $this->assertEquals('bar', $routes['blog_show']->getOption('foo')); - $this->assertEquals('{locale}.example.com', $routes['blog_show']->getHostnamePattern()); + $this->assertEquals('{locale}.example.com', $routes['blog_show']->getHostname()); } /** diff --git a/src/Symfony/Component/Routing/Tests/Loader/YamlFileLoaderTest.php b/src/Symfony/Component/Routing/Tests/Loader/YamlFileLoaderTest.php index f99e789486..b6a0c09b3f 100644 --- a/src/Symfony/Component/Routing/Tests/Loader/YamlFileLoaderTest.php +++ b/src/Symfony/Component/Routing/Tests/Loader/YamlFileLoaderTest.php @@ -86,7 +86,7 @@ class YamlFileLoaderTest extends \PHPUnit_Framework_TestCase $this->assertEquals('MyBlogBundle:Blog:show', $route->getDefault('_controller')); $this->assertEquals('GET', $route->getRequirement('_method')); $this->assertEquals('\w+', $route->getRequirement('locale')); - $this->assertEquals('{locale}.example.com', $route->getHostnamePattern()); + $this->assertEquals('{locale}.example.com', $route->getHostname()); $this->assertEquals('RouteCompiler', $route->getOption('compiler_class')); } @@ -103,6 +103,6 @@ class YamlFileLoaderTest extends \PHPUnit_Framework_TestCase $this->assertEquals('123', $routes['blog_show']->getDefault('foo')); $this->assertEquals('\d+', $routes['blog_show']->getRequirement('foo')); $this->assertEquals('bar', $routes['blog_show']->getOption('foo')); - $this->assertEquals('{locale}.example.com', $routes['blog_show']->getHostnamePattern()); + $this->assertEquals('{locale}.example.com', $routes['blog_show']->getHostname()); } } diff --git a/src/Symfony/Component/Routing/Tests/Matcher/UrlMatcherTest.php b/src/Symfony/Component/Routing/Tests/Matcher/UrlMatcherTest.php index 18e11ebcfb..7f0e10afdf 100644 --- a/src/Symfony/Component/Routing/Tests/Matcher/UrlMatcherTest.php +++ b/src/Symfony/Component/Routing/Tests/Matcher/UrlMatcherTest.php @@ -368,7 +368,7 @@ class UrlMatcherTest extends \PHPUnit_Framework_TestCase $coll = new RouteCollection(); $coll->add('foo', new Route('/foo/{foo}')); $coll->add('bar', new Route('/bar/{foo}', array(), array(), array(), '{locale}.example.net')); - $coll->setHostnamePattern('{locale}.example.com'); + $coll->setHostname('{locale}.example.com'); $matcher = new UrlMatcher($coll, new RequestContext('', 'GET', 'en.example.com')); $this->assertEquals(array('foo' => 'bar', '_route' => 'foo', 'locale' => 'en'), $matcher->match('/foo/bar')); diff --git a/src/Symfony/Component/Routing/Tests/RouteCollectionTest.php b/src/Symfony/Component/Routing/Tests/RouteCollectionTest.php index de1d9b1f39..fe33c81508 100644 --- a/src/Symfony/Component/Routing/Tests/RouteCollectionTest.php +++ b/src/Symfony/Component/Routing/Tests/RouteCollectionTest.php @@ -224,7 +224,7 @@ class RouteCollectionTest extends \PHPUnit_Framework_TestCase $this->assertNull($collection1->get(0), '->get() does not disclose internal child RouteCollection'); } - public function testSetHostnamePattern() + public function testSetHostname() { $collection = new RouteCollection(); $routea = new Route('/a'); @@ -232,9 +232,9 @@ class RouteCollectionTest extends \PHPUnit_Framework_TestCase $collection->add('a', $routea); $collection->add('b', $routeb); - $collection->setHostnamePattern('{locale}.example.com'); + $collection->setHostname('{locale}.example.com'); - $this->assertEquals('{locale}.example.com', $routea->getHostnamePattern()); - $this->assertEquals('{locale}.example.com', $routeb->getHostnamePattern()); + $this->assertEquals('{locale}.example.com', $routea->getHostname()); + $this->assertEquals('{locale}.example.com', $routeb->getHostname()); } } diff --git a/src/Symfony/Component/Routing/Tests/RouteTest.php b/src/Symfony/Component/Routing/Tests/RouteTest.php index a3e4fdcdb2..f5bc8f4b7d 100644 --- a/src/Symfony/Component/Routing/Tests/RouteTest.php +++ b/src/Symfony/Component/Routing/Tests/RouteTest.php @@ -22,7 +22,7 @@ class RouteTest extends \PHPUnit_Framework_TestCase $this->assertEquals(array('foo' => 'bar'), $route->getDefaults(), '__construct() takes defaults as its second argument'); $this->assertEquals(array('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->getHostnamePattern(), '__construct() takes a hostname pattern as its fifth argument'); + $this->assertEquals('{locale}.example.com', $route->getHostname(), '__construct() takes a hostname pattern as its fifth argument'); $route = new Route('/', array(), array(), array(), '', array('Https'), array('POST', 'put')); $this->assertEquals(array('https'), $route->getSchemes(), '__construct() takes schemes as its sixth argument and lowercases it'); @@ -130,11 +130,11 @@ class RouteTest extends \PHPUnit_Framework_TestCase ); } - public function testHostnamePattern() + public function testHostname() { $route = new Route('/'); - $route->setHostnamePattern('{locale}.example.net'); - $this->assertEquals('{locale}.example.net', $route->getHostnamePattern(), '->setHostnamePattern() sets the hostname pattern'); + $route->setHostname('{locale}.example.net'); + $this->assertEquals('{locale}.example.net', $route->getHostname(), '->setHostname() sets the hostname pattern'); } public function testScheme()