Skip to content

Commit

Permalink
added test for check nested url
Browse files Browse the repository at this point in the history
  • Loading branch information
ltunc committed Jan 29, 2012
1 parent 4dd13ef commit 57bd1ea
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions lib/Cake/Test/Case/Routing/Route/CakeRouteTest.php
Expand Up @@ -403,6 +403,26 @@ public function testParseNamedParametersUrlDecode() {
$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
*
Expand Down

0 comments on commit 57bd1ea

Please sign in to comment.