瀏覽代碼

[Routing] Adding a failing test related to URL generation with optional parameters

Ryan Weaver 14 年之前
父節點
當前提交
c867dccbed
共有 1 個文件被更改,包括 7 次插入0 次删除
  1. 7 0
      tests/Symfony/Tests/Component/Routing/Generator/UrlGeneratorTest.php

+ 7 - 0
tests/Symfony/Tests/Component/Routing/Generator/UrlGeneratorTest.php

@@ -184,6 +184,13 @@ class UrlGeneratorTest extends \PHPUnit_Framework_TestCase
         $this->assertEquals('http://localhost/app.php/', $this->getGenerator($routes, array('scheme' => 'https'))->generate('test'));
     }
 
+    public function testNoTrailingSlashForMultipleOptionalParameters()
+    {
+        $routes = $this->getRoutes('test', new Route('/category/{slug1}/{slug2}/{slug3}', array('slug2' => null, 'slug3' => null)));
+
+        $this->assertEquals('/app.php/category/foo', $this->getGenerator($routes)->generate('test', array('slug1' => 'foo')));
+    }
+
     protected function getGenerator(RouteCollection $routes, array $parameters = array())
     {
         $context = new RequestContext('/app.php');