mirror of
https://github.com/dannyvankooten/AltoRouter.git
synced 2025-08-02 14:37:43 +02:00
add failing test for generate
This commit is contained in:
@@ -234,6 +234,26 @@ class AltoRouterTest extends PHPUnit_Framework_TestCase
|
|||||||
$this->router->generate('bar_route', $params));
|
$this->router->generate('bar_route', $params));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GitHub #98
|
||||||
|
*/
|
||||||
|
public function testGenerateWithOptionalPartOnBareUrl()
|
||||||
|
{
|
||||||
|
$this->router->map('GET', '/[i:page]?', function(){}, 'bare_route');
|
||||||
|
|
||||||
|
$params = array(
|
||||||
|
'page' => 1
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->assertEquals('/1',
|
||||||
|
$this->router->generate('bare_route', $params));
|
||||||
|
|
||||||
|
$params = array();
|
||||||
|
|
||||||
|
$this->assertEquals('/',
|
||||||
|
$this->router->generate('bare_route', $params));
|
||||||
|
}
|
||||||
|
|
||||||
public function testGenerateWithNonexistingRoute()
|
public function testGenerateWithNonexistingRoute()
|
||||||
{
|
{
|
||||||
try{
|
try{
|
||||||
@@ -390,9 +410,7 @@ class AltoRouterTest extends PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
$this->assertEquals(array(
|
$this->assertEquals(array(
|
||||||
'target' => 'bare_action',
|
'target' => 'bare_action',
|
||||||
'params' => array(
|
'params' => array(),
|
||||||
|
|
||||||
),
|
|
||||||
'name' => 'bare_route'
|
'name' => 'bare_route'
|
||||||
), $this->router->match('/', 'GET'));
|
), $this->router->match('/', 'GET'));
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user