1
0
mirror of https://github.com/dannyvankooten/AltoRouter.git synced 2025-08-05 07:57:38 +02:00

Add tests for non-regex routes, see #100

This commit is contained in:
Danny van Kooten
2015-11-03 08:03:34 +07:00
parent 97b2ba7daf
commit b0d115431e

View File

@@ -274,6 +274,20 @@ class AltoRouterTest extends PHPUnit_Framework_TestCase
} }
public function testMatchWithNonRegex() {
$this->router->map('GET','/about-us', 'PagesController#about', 'about_us');
$this->assertEquals(array(
'target' => 'PagesController#about',
'params' => array(),
'name' => 'about_us'
), $this->router->match('/about-us', 'GET'));
$this->assertFalse($this->router->match('/about-us', 'POST'));
$this->assertFalse($this->router->match('/about', 'GET'));
$this->assertFalse($this->router->match('/about-us-again', 'GET'));
}
public function testMatchWithFixedParamValues() public function testMatchWithFixedParamValues()
{ {
$this->router->map('POST','/users/[i:id]/[delete|update:action]', 'usersController#doAction', 'users_do'); $this->router->map('POST','/users/[i:id]/[delete|update:action]', 'usersController#doAction', 'users_do');