diff --git a/Tests/Matcher/UrlMatcherTest.php b/Tests/Matcher/UrlMatcherTest.php index 0c2756e4..6448a75e 100644 --- a/Tests/Matcher/UrlMatcherTest.php +++ b/Tests/Matcher/UrlMatcherTest.php @@ -1000,6 +1000,30 @@ public function testUtf8VarName() $this->assertEquals(['_route' => 'foo', 'bär' => 'baz', 'bäz' => 'foo'], $matcher->match('/foo/baz')); } + public function testParameterWithRequirementWithDefault() + { + $collection = new RouteCollection(); + + $route = new Route('/test/{foo}', ['foo' => 'foo-'], ['foo' => '\w+']); + $collection->add('test', $route); + + $matcher = $this->getUrlMatcher($collection); + + $result = $matcher->match('/test/foo'); + $this->assertSame('test', $result['_route']); + $this->assertSame('foo', $result['foo']); + + try { + $matcher->match('/test/foo-'); + } catch (ResourceNotFoundException $e) { + $this->assertStringContainsString('No routes found', $e->getMessage()); + } + + $result = $matcher->match('/test'); + $this->assertSame('test', $result['_route']); + $this->assertSame('foo-', $result['foo']); + } + public function testMapping() { $collection = new RouteCollection();
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: