mirror of
https://github.com/dannyvankooten/AltoRouter.git
synced 2025-08-04 15:37:45 +02:00
add test for #241
This commit is contained in:
@@ -142,10 +142,10 @@ class AltoRouterTest extends PHPUnit\Framework\TestCase
|
||||
*/
|
||||
public function testSetBasePath()
|
||||
{
|
||||
$basePath = $this->router->setBasePath('/some/path');
|
||||
$this->router->setBasePath('/some/path');
|
||||
$this->assertEquals('/some/path', $this->router->getBasePath());
|
||||
|
||||
$basePath = $this->router->setBasePath('/some/path');
|
||||
$this->router->setBasePath('/some/path');
|
||||
$this->assertEquals('/some/path', $this->router->getBasePath());
|
||||
}
|
||||
|
||||
@@ -519,6 +519,20 @@ class AltoRouterTest extends PHPUnit\Framework\TestCase
|
||||
$this->assertFalse($this->router->match('/﷽', 'GET'));
|
||||
}
|
||||
|
||||
public function testMatchWithSlashBeforeOptionalPart()
|
||||
{
|
||||
$this->router->map('GET', '/archives/[lmin:category]?', 'Article#archives');
|
||||
$expected = [
|
||||
'target' => 'Article#archives',
|
||||
'params' => [],
|
||||
'name' => null
|
||||
];
|
||||
|
||||
$this->assertEquals($expected, $this->router->match('/archives/', 'GET'));
|
||||
$this->assertEquals($expected, $this->router->match('/archives', 'GET'));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers AltoRouter::addMatchTypes
|
||||
*/
|
||||
|
Reference in New Issue
Block a user