Skip to content

Commit bb89cc5

Browse files
authored
Adding tests for Overlapping Routes (#54050)
1 parent 16c01c2 commit bb89cc5

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

tests/Routing/RouteCollectionTest.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,4 +325,20 @@ public function testToSymfonyRouteCollection()
325325

326326
$this->assertInstanceOf("\Symfony\Component\Routing\RouteCollection", $this->routeCollection->toSymfonyRouteCollection());
327327
}
328+
329+
public function testOverlappingRoutesMatchesFirstRoute()
330+
{
331+
$this->routeCollection->add(
332+
new Route('GET', 'users/{id}/{other}', ['uses' => 'UsersController@other', 'as' => 'first'])
333+
);
334+
335+
$this->routeCollection->add(
336+
new Route('GET', 'users/{id}/show', ['uses' => 'UsersController@show', 'as' => 'second'])
337+
);
338+
339+
$request = Request::create('users/1/show', 'GET');
340+
341+
$this->assertCount(2, $this->routeCollection->getRoutes());
342+
$this->assertEquals('first', $this->routeCollection->match($request)->getName());
343+
}
328344
}

0 commit comments

Comments
 (0)