Skip to content
Permalink
Browse files

Adding more tests to CakeRequest::addDetector() for callback type.

  • Loading branch information...
markstory committed Apr 30, 2010
1 parent 6dcc680 commit 0bbd7fae2c061e4aad80e45f257c256dfd5d2629
Showing with 17 additions and 0 deletions.
  1. +17 −0 cake/tests/cases/libs/cake_request.test.php
@@ -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.
You can’t perform that action at this time.