public function UrlMatcherTest::testWithHostOnRouteCollection

File

drupal/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Matcher/UrlMatcherTest.php, line 358

Class

UrlMatcherTest

Namespace

Symfony\Component\Routing\Tests\Matcher

Code

public function testWithHostOnRouteCollection() {
  $coll = new RouteCollection();
  $coll
    ->add('foo', new Route('/foo/{foo}'));
  $coll
    ->add('bar', new Route('/bar/{foo}', array(), array(), array(), '{locale}.example.net'));
  $coll
    ->setHost('{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'));
  $matcher = new UrlMatcher($coll, new RequestContext('', 'GET', 'en.example.com'));
  $this
    ->assertEquals(array(
    'foo' => 'bar',
    '_route' => 'bar',
    'locale' => 'en',
  ), $matcher
    ->match('/bar/bar'));
}