/** * testMobileDeviceDetection method * * @access public * @return void */ function testMobileDeviceDetection() { $this->assertFalse($this->RequestHandler->isMobile()); $_SERVER['HTTP_USER_AGENT'] = 'Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en) AppleWebKit/420+ (KHTML, like Gecko) Version/3.0 Mobile/1A543a Safari/419.3'; $this->assertTrue($this->RequestHandler->isMobile()); $_SERVER['HTTP_USER_AGENT'] = 'Some imaginary UA'; $this->RequestHandler->mobileUA[] = 'imaginary'; $this->assertTrue($this->RequestHandler->isMobile()); array_pop($this->RequestHandler->mobileUA); }
/** * testMobileDeviceDetection method * * @return void */ public function testMobileDeviceDetection() { $request = $this->getMock('CakeRequest'); $request->expects($this->once())->method('is')->with('mobile')->will($this->returnValue(true)); $this->RequestHandler->request = $request; $this->assertTrue($this->RequestHandler->isMobile()); }