Example #1
0
 public function testMatchWith()
 {
     $route = new Route('/blog/:id-:slug', function ($id, $slug) {
         return 'hello';
     });
     $route->with(['id' => '[0-9]+']);
     $this->assertTrue($route->match('/blog/12-my-title'));
     $this->assertEquals('12', $route->getMatches()[0]);
     $this->assertFalse($route->match('/blog/my-title-12'));
     $this->assertEquals(0, count($route->getMatches()));
 }