예제 #1
0
 /**
  *
  */
 public function testConstruct()
 {
     $userAgent = 'Mozilla/5.0 (Randomized by FreeSafeIP.com/upgrade-to-remove; compatible; MSIE 8.0; Windows NT 5.0) Chrome/21.0.1229.79';
     $header = array('HTTP_USER_AGENT' => $userAgent);
     $request = new GenericRequest($header, $userAgent, null, false);
     $device = new Device($request);
     self::assertSame($request, $device->getHttpRequest());
     self::assertSame($userAgent, $device->getDeviceUa());
     self::assertSame($userAgent, $device->getBrowserUa());
     self::assertSame($device->getBrowserUaNormalized(), $device->getDeviceUaNormalized());
     self::assertInstanceOf('\\Wurfl\\VirtualCapability\\Tool\\NameVersionPair', $device->getBrowser());
     self::assertInstanceOf('\\Wurfl\\VirtualCapability\\Tool\\NameVersionPair', $device->getOs());
 }
예제 #2
0
 /**
  * normalize the Browser Information
  *
  * @param \Wurfl\VirtualCapability\Tool\Device $device
  */
 private static function normalizeBrowser(Device $device)
 {
     if ($device->getBrowser()->name === 'IE' && preg_match('#Trident/([\\d\\.]+)#', $device->getDeviceUa(), $matches)) {
         if (array_key_exists($matches[1], self::$trident_map)) {
             $compatibilityViewCheck = self::$trident_map[$matches[1]];
             if ($device->getBrowser()->version !== $compatibilityViewCheck) {
                 $device->getBrowser()->version = $compatibilityViewCheck . '(Compatibility View)';
             }
             return;
         }
     }
 }