Ejemplo n.º 1
0
 public function testExtractsNamedPlaceholdersFromPathAndAddsToAttributes()
 {
     $route = new Route('test.route', '/api/:version/users/:id', function () {
     });
     $expected = ['version' => null, 'id' => null];
     $this->assertTrue($expected == $route->getAttributes());
 }
Ejemplo n.º 2
0
 public function testRouteAttributesArePopulatedWithValues()
 {
     $route = new Route('test.route', '/api/:version/users/:id', function () {
     });
     $matcher = new Matcher(new Collection([$route]));
     $request = $this->getRequestWithPath('/api/v3/users/65535');
     $matcher->match($request);
     $this->assertEquals(['version' => 'v3', 'id' => '65535'], $route->getAttributes());
 }