Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
Quentin authored and qpautrat committed Dec 2, 2015
1 parent 608ad42 commit 3f02d09
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
7 changes: 5 additions & 2 deletions Tests/Router/Fixture/routing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ welcome:

untranslated_route:
path: /not-translated

not_available_in_all_locales:
path: /not-available-in-all-locales
options: { i18n_locales: [de, en] }

login:
path: /login
schemes: [https]

login_check:
path: /this-is-used-for-checking-login
options: { i18n: false }
Expand Down Expand Up @@ -45,3 +45,6 @@ enUK_only:

sub_locale:
path: /english

multiple_locale:
path: /multiple_locale
11 changes: 11 additions & 0 deletions Tests/Router/I18nRouterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,17 @@ public function testMatchCallsLocaleResolverIfRouteSupportsMultipleLocalesAndCon
$this->assertSame('de', $params['_locale']);
}

public function testMultipleLocale()
{
$router = $this->getNonRedirectingHostMapRouter();

$context = new RequestContext('/', 'GET', 'uk.test');
$context->setParameter('_locale', 'en');
$router->setContext($context);

$this->assertEquals(array('_locale' => 'en_UK', '_route' => 'multiple_locale'), $router->match('/multiple_locale'));
}

private function getRouter($config = 'routing.yml', $translator = null, $localeResolver = null)
{
$container = new Container();
Expand Down

0 comments on commit 3f02d09

Please sign in to comment.