Skip to content

Commit

Permalink
Added test for and fixed flatten
Browse files Browse the repository at this point in the history
  • Loading branch information
Gisleburt committed Feb 28, 2015
1 parent fc98204 commit 46ed406
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ public function getParameter($key, $default = null)
*/
protected function flatten($name)
{
return strtolower(preg_replace('/\W_/', '', $name));
return strtolower(preg_replace('/[\W_-]/', '', $name));
}

/**
Expand Down
11 changes: 11 additions & 0 deletions tests/RequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -414,4 +414,15 @@ public function testGetFormatFromUri()
$request->getFormatFromUri($uri)
);
}

public function testVariableFlattening()
{
$parameters =
[ 'nAmE' => 'string'];
$request = new Request(null, null, $parameters);
$this->assertSame(
'string',
$request->getParameter('na-me')
);
}
}

0 comments on commit 46ed406

Please sign in to comment.