Skip to content

Commit

Permalink
Adding tests for Overlapping Routes (#54050)
Browse files Browse the repository at this point in the history
  • Loading branch information
mathiasgrimm authored Jan 1, 2025
1 parent 16c01c2 commit bb89cc5
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/Routing/RouteCollectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -325,4 +325,20 @@ public function testToSymfonyRouteCollection()

$this->assertInstanceOf("\Symfony\Component\Routing\RouteCollection", $this->routeCollection->toSymfonyRouteCollection());
}

public function testOverlappingRoutesMatchesFirstRoute()
{
$this->routeCollection->add(
new Route('GET', 'users/{id}/{other}', ['uses' => 'UsersController@other', 'as' => 'first'])
);

$this->routeCollection->add(
new Route('GET', 'users/{id}/show', ['uses' => 'UsersController@show', 'as' => 'second'])
);

$request = Request::create('users/1/show', 'GET');

$this->assertCount(2, $this->routeCollection->getRoutes());
$this->assertEquals('first', $this->routeCollection->match($request)->getName());
}
}

0 comments on commit bb89cc5

Please sign in to comment.