Pārlūkot izejas kodu

fixed some routing patterns

Fabien Potencier 14 gadi atpakaļ
vecāks
revīzija
6dd1d6172f

+ 1 - 1
src/Symfony/Component/Routing/Loader/AnnotationClassLoader.php

@@ -45,7 +45,7 @@ use Symfony\Component\Routing\RouteCollection;
  *         }
  *
  *         /**
- *          * @Route("/:id", name="blog_post", requirements = {"id" = "\d+"})
+ *          * @Route("/{id}", name="blog_post", requirements = {"id" = "\d+"})
  *          * /
  *         public function show()
  *         {

+ 3 - 3
tests/Symfony/Tests/Component/Routing/CompiledRouteTest.php

@@ -18,7 +18,7 @@ class CompiledRouteTest extends \PHPUnit_Framework_TestCase
 {
     public function testAccessors()
     {
-        $route = new Route('/:foo', array('foo' => 'bar'), array('foo' => '\d+'), array('foo' => 'bar'));
+        $route = new Route('/{foo}', array('foo' => 'bar'), array('foo' => '\d+'), array('foo' => 'bar'));
 
         $compiled = new CompiledRoute($route, 'prefix', 'regex', array('tokens'), array('variables'));
         $this->assertEquals($route, $compiled->getRoute(), '__construct() takes a route as its first argument');
@@ -30,10 +30,10 @@ class CompiledRouteTest extends \PHPUnit_Framework_TestCase
 
     public function testgetPatterngetDefaultsgetOptionsgetRequirements()
     {
-        $route = new Route('/:foo', array('foo' => 'bar'), array('foo' => '\d+'), array('foo' => 'bar'));
+        $route = new Route('/{foo}', array('foo' => 'bar'), array('foo' => '\d+'), array('foo' => 'bar'));
 
         $compiled = new CompiledRoute($route, 'prefix', 'regex', array('tokens'), array('variables'));
-        $this->assertEquals('/:foo', $compiled->getPattern(), '->getPattern() returns the route pattern');
+        $this->assertEquals('/{foo}', $compiled->getPattern(), '->getPattern() returns the route pattern');
         $this->assertEquals(array('foo' => 'bar'), $compiled->getDefaults(), '->getDefaults() returns the route defaults');
         $this->assertEquals(array('foo' => '\d+'), $compiled->getRequirements(), '->getRequirements() returns the route requirements');
         $this->assertEquals(array_merge(array(

+ 1 - 1
tests/Symfony/Tests/Component/Routing/Matcher/UrlMatcherTest.php

@@ -20,7 +20,7 @@ class UrlMatcherTest extends \PHPUnit_Framework_TestCase
     public function testNormalizeUrl()
     {
         $collection = new RouteCollection();
-        $collection->add('foo', new Route('/:foo'));
+        $collection->add('foo', new Route('/{foo}'));
 
         $matcher = new UrlMatcherForTests($collection, array(), array());