Skip to content
Permalink
Browse files

making the name lowercase in the addDetector method so that it will b…

…e found in the is() method fixes #2622 with tests.
  • Loading branch information...
dogmatic69 committed Feb 28, 2012
1 parent 677f070 commit ac068802418ff00167070d9ffddf33138d385b8c
Showing with 6 additions and 0 deletions.
  1. +1 −0 lib/Cake/Network/CakeRequest.php
  2. +5 −0 lib/Cake/Test/Case/Network/CakeRequestTest.php
@@ -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);
}
@@ -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';

0 comments on commit ac06880

Please sign in to comment.
You can’t perform that action at this time.