Skip to content

Commit 7614b8c

Browse files
Merge branch '7.2' into 7.3
* 7.2: [DoctrineBridge] Prevent idle connection listener from running on subrequests [Routing] Add test to validate that default value is allowed to not match requirement fix handling required options Fix @var phpdoc [Lock] [MongoDB] Enforce readPreference=primary and writeConcern=majority [FrameworkBundle] fix phpdoc in `MicroKernelTrait` Fixed validator translations for Albanian
2 parents 8e21382 + d5a038e commit 7614b8c

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

Tests/Matcher/UrlMatcherTest.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1000,6 +1000,30 @@ public function testUtf8VarName()
10001000
$this->assertEquals(['_route' => 'foo', 'bär' => 'baz', 'bäz' => 'foo'], $matcher->match('/foo/baz'));
10011001
}
10021002

1003+
public function testParameterWithRequirementWithDefault()
1004+
{
1005+
$collection = new RouteCollection();
1006+
1007+
$route = new Route('/test/{foo}', ['foo' => 'foo-'], ['foo' => '\w+']);
1008+
$collection->add('test', $route);
1009+
1010+
$matcher = $this->getUrlMatcher($collection);
1011+
1012+
$result = $matcher->match('/test/foo');
1013+
$this->assertSame('test', $result['_route']);
1014+
$this->assertSame('foo', $result['foo']);
1015+
1016+
try {
1017+
$matcher->match('/test/foo-');
1018+
} catch (ResourceNotFoundException $e) {
1019+
$this->assertStringContainsString('No routes found', $e->getMessage());
1020+
}
1021+
1022+
$result = $matcher->match('/test');
1023+
$this->assertSame('test', $result['_route']);
1024+
$this->assertSame('foo-', $result['foo']);
1025+
}
1026+
10031027
public function testMapping()
10041028
{
10051029
$collection = new RouteCollection();

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

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:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy