Skip to content

Commit

Permalink
Added test case for param with options detector.
Browse files Browse the repository at this point in the history
Fix coding standards errors.
  • Loading branch information
clns authored and markstory committed Aug 27, 2013
1 parent cf3dfb0 commit 075bf37
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/Cake/Network/CakeRequest.php
Expand Up @@ -521,7 +521,7 @@ public function is($type) {
return isset($this->params[$key]) ? $this->params[$key] == $value : false;
}
if (isset($detect['options'])) {
return isset($this->params[$key]) ? in_array($this->params[$key],$detect['options']) : false;
return isset($this->params[$key]) ? in_array($this->params[$key], $detect['options']) : false;
}
}
if (isset($detect['callback']) && is_callable($detect['callback'])) {
Expand Down
7 changes: 7 additions & 0 deletions lib/Cake/Test/Case/Network/CakeRequestTest.php
Expand Up @@ -1050,6 +1050,13 @@ public function testAddDetector() {

$request->return = false;
$this->assertFalse($request->isCallMe());

$request->addDetector('extension', array('param' => 'ext', 'options' => array('pdf', 'png', 'txt')));
$request->params['ext'] = 'pdf';
$this->assertTrue($request->is('extension'));

$request->params['ext'] = 'exe';
$this->assertFalse($request->isExtension());
}

/**
Expand Down

0 comments on commit 075bf37

Please sign in to comment.