added test for check nested url

This commit is contained in:
Anton 2012-01-30 00:25:48 +02:00
parent 4dd13ef554
commit 57bd1ea5f9

View file

@ -403,6 +403,26 @@ class CakeRouteTest extends CakeTestCase {
$this->assertEquals('something else', $result['pass'][0]); $this->assertEquals('something else', $result['pass'][0]);
} }
/**
* Ensure that keys at named parameters are urldecoded
*
* @return void
*/
public function testParseNamedKeyUrlDecode() {
Router::connectNamed(true);
$route = new CakeRoute('/:controller/:action/*', array('plugin' => null));
// checking /post/index/user[0]:a/user[1]:b
$result = $route->parse('/posts/index/user%5B0%5D:a/user%5B1%5D:b');
$this->assertArrayHasKey('user', $result['named']);
$this->assertEquals(array('a', 'b'), $result['named']['user']);
// checking /post/index/user[]:a/user[]:b
$result = $route->parse('/posts/index/user%5B%5D:a/user%5B%5D:b');
$this->assertArrayHasKey('user', $result['named']);
$this->assertEquals(array('a', 'b'), $result['named']['user']);
}
/** /**
* test that named params with null/false are excluded * test that named params with null/false are excluded
* *