Skip to content

Commit

Permalink
Merge pull request #534 from dogmatic69/2622
Browse files Browse the repository at this point in the history
Fixes #2622
  • Loading branch information
markstory committed Feb 28, 2012
2 parents 2665178 + ac06880 commit 6599422
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/Cake/Network/CakeRequest.php
Expand Up @@ -516,6 +516,7 @@ public function is($type) {
* @return void
*/
public function addDetector($name, $options) {
$name = strtolower($name);
if (isset($this->_detectors[$name]) && isset($options['options'])) {
$options = Set::merge($this->_detectors[$name], $options);
}
Expand Down
5 changes: 5 additions & 0 deletions lib/Cake/Test/Case/Network/CakeRequestTest.php
Expand Up @@ -793,6 +793,11 @@ public function testAddDetector() {

$_SERVER['TEST_VAR'] = 'wrong';
$this->assertFalse($request->is('compare'), 'Value mis-match failed.');

$request->addDetector('compareCamelCase', array('env' => 'TEST_VAR', 'value' => 'foo'));

$_SERVER['TEST_VAR'] = 'foo';
$this->assertTrue($request->is('compareCamelCase'), 'Value match failed.');

$request->addDetector('banana', array('env' => 'TEST_VAR', 'pattern' => '/^ban.*$/'));
$_SERVER['TEST_VAR'] = 'banana';
Expand Down

0 comments on commit 6599422

Please sign in to comment.