Skip to content

Commit

Permalink
[Routing] added working test case for issue #5135
Browse files Browse the repository at this point in the history
  • Loading branch information
Tobion committed Oct 24, 2013
1 parent 2a637b1 commit 8513ac9
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions src/Symfony/Bundle/FrameworkBundle/Tests/Routing/RouterTest.php
Expand Up @@ -17,6 +17,32 @@

class RoutingTest extends \PHPUnit_Framework_TestCase
{
public function testGenerateWithServiceParam()
{
$routes = new RouteCollection();

$routes->add('foo', new Route(
' /{_locale}',
array(
'_locale' => '%locale%'
),
array(
'_locale' => 'en|es',
)
));

$sc = $this->getServiceContainer($routes);

$sc->expects($this->at(1))->method('hasParameter')->will($this->returnValue(true));
$sc->expects($this->at(2))->method('getParameter')->will($this->returnValue('es'));

$router = new Router($sc, 'foo');
$route = $router->getRouteCollection()->get('foo');

$this->assertSame('/en', $router->generate('foo', array('_locale' => 'en')));
$this->assertSame('/', $router->generate('foo', array('_locale' => 'es')));
}

public function testDefaultsPlaceholders()
{
$routes = new RouteCollection();
Expand Down

0 comments on commit 8513ac9

Please sign in to comment.