Skip to content
Browse files

added test for matching with an overwritten prefix that failed previo…

…usly
  • Loading branch information...
1 parent b69e8b2 commit ec04b5e91f8bd041cd783bc81f81241c4bd0f0df @Tobion committed Dec 6, 2012
Showing with 16 additions and 0 deletions.
  1. +16 −0 src/Symfony/Component/Routing/Tests/Matcher/UrlMatcherTest.php
View
16 src/Symfony/Component/Routing/Tests/Matcher/UrlMatcherTest.php
@@ -338,6 +338,22 @@ public function testDecodeOnce()
$this->assertEquals(array('foo' => 'bar%23', '_route' => 'foo'), $matcher->match('/foo/bar%2523'));
}
+ public function testCannotRelyOnPrefix()
+ {
+ $coll = new RouteCollection();
+
+ $subColl = new RouteCollection();
+ $subColl->add('bar', new Route('/bar'));
+ $subColl->addPrefix('/prefix');
+ // overwrite the pattern, so the prefix is not valid anymore for this route in the collection
+ $subColl->get('bar')->setPattern('/new');
+
+ $coll->addCollection($subColl);
+
+ $matcher = new UrlMatcher($coll, new RequestContext());
+ $this->assertEquals(array('_route' => 'bar'), $matcher->match('/new'));
+ }
+
public function testWithHostname()
{
$coll = new RouteCollection();

0 comments on commit ec04b5e

Please sign in to comment.
Something went wrong with that request. Please try again.