Parameters are by default now using regex [\w\-]+ (supports dashes) to avoid confusion.

This commit is contained in:
Simon Sessingø
2021-03-18 03:24:47 +01:00
parent fb726c3613
commit 19b1a14dec
4 changed files with 27 additions and 9 deletions
@@ -150,6 +150,21 @@ class RouterRouteTest extends \PHPUnit\Framework\TestCase
$this->assertTrue(true);
}
public function testParametersWithDashes()
{
$defaultVariable = null;
TestRouter::get('/my/{path}', function ($path = 'working') use (&$defaultVariable) {
$defaultVariable = $path;
});
TestRouter::debug('/my/hello-motto-man');
$this->assertEquals('hello-motto-man', $defaultVariable);
}
public function testParameterDefaultValue()
{