Skip to content

Commit

Permalink
Adding more tests to CakeRequest::addDetector() for callback type.
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Apr 30, 2010
1 parent 6dcc680 commit 0bbd7fa
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions cake/tests/cases/libs/cake_request.test.php
Expand Up @@ -549,5 +549,22 @@ function testAddDetector() {

$_SERVER['HTTP_USER_AGENT'] = 'iPhone 3.0';
$this->assertTrue($request->isMobile());

$request->addDetector('callme', array('env' => 'TEST_VAR', 'callback' => array($this, '_detectCallback')));

$request->return = true;
$this->assertTrue($request->isCallMe());

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

/**
* helper function for testing callbacks.
*
* @return void
*/
function _detectCallback($request) {
return $request->return == true;
}
}

0 comments on commit 0bbd7fa

Please sign in to comment.