Adding Fennec as a built-in mobile browser.

Refactoring a test case to pull out the exceptional case.
Fixes #932
This commit is contained in:
mark_story 2010-10-27 22:32:15 -04:00
parent 1166806218
commit d7847288e4
2 changed files with 14 additions and 2 deletions

View file

@ -100,7 +100,7 @@ class CakeRequest implements ArrayAccess {
'ajax' => array('env' => 'HTTP_X_REQUESTED_WITH', 'value' => 'XMLHttpRequest'),
'flash' => array('env' => 'HTTP_USER_AGENT', 'pattern' => '/^(Shockwave|Adobe) Flash/'),
'mobile' => array('env' => 'HTTP_USER_AGENT', 'options' => array(
'Android', 'AvantGo', 'BlackBerry', 'DoCoMo', 'iPod', 'iPhone',
'Android', 'AvantGo', 'BlackBerry', 'DoCoMo', 'Fennec', 'iPod', 'iPhone',
'J2ME', 'MIDP', 'NetFront', 'Nokia', 'Opera Mini', 'PalmOS', 'PalmSource',
'portalmmm', 'Plucker', 'ReqwirelessWeb', 'SonyEricsson', 'Symbian', 'UP\\.Browser',
'webOS', 'Windows CE', 'Xiino'

View file

@ -606,7 +606,19 @@ class CakeRequestTestCase extends CakeTestCase {
$this->assertTrue($request->is('mobile'));
$this->assertTrue($request->isMobile());
$this->expectException();
$_SERVER['HTTP_USER_AGENT'] = 'Mozilla/5.0 (Windows NT 5.1; rv:2.0b6pre) Gecko/20100902 Firefox/4.0b6pre Fennec/2.0b1pre';
$this->assertTrue($request->is('mobile'));
$this->assertTrue($request->isMobile());
}
/**
* test __call expcetions
*
* @expectedException Exception
* @return void
*/
function test__callExceptionOnUnknownMethod() {
$request = new CakeRequest('some/path');
$request->IamABanana();
}