コード例 #1
0
 /**
  *
  * Tests Detection of devices. 
  * 
  * @dataProvider provider 
  *
  * @access public
  * @return void
  */
 public function testDeviceDetection($userAgents)
 {
     foreach ($userAgents as $category => $userAgent) {
         $deviceManager = new DeviceManager();
         $computedCategory = $deviceManager->determineCategory($userAgent);
         $this->assertEquals($category, $computedCategory);
     }
 }
コード例 #2
0
 /**
  * Default constructor 
  * 
  * @param mixed $request User Request object.
  *
  * @access public
  * @return void
  */
 public function __construct($request = null)
 {
     $app = $GLOBALS['app'];
     if ($request === null) {
         $request = $_REQUEST;
     }
     $this->_map = array();
     $deviceMgr = new DeviceManager();
     $this->_map['device'] = $deviceMgr->determineCategory($_SERVER["HTTP_USER_AGENT"], $app->getConfiguration()->getDefaultGrade());
     $latitude = isset($_REQUEST['lat']) ? $_REQUEST['lat'] : '0.00';
     $longitude = isset($_REQUEST['lng']) ? $_REQUEST['lng'] : '0.00';
     $this->_map['location'] = array('latitude' => $latitude, 'longitude' => $longitude);
 }
コード例 #3
0
 /**
  *
  * Tests Detection of devices. 
  * 
  * @dataProvider provider 
  *
  * @access public
  * @return void
  */
 public function testDeviceDetection($userAgent)
 {
     $deviceManager = new DeviceManager();
     $computedCategory = $deviceManager->determineCategory($userAgent);
     $this->assertFalse($computedCategory === "XXXX");
 }