Inheritance: extends AbstractProvider
コード例 #1
0
 public function testRealResult()
 {
     $provider = new DonatjUAParser();
     $result = $provider->parse('Mozilla/5.0 (X11; U; CrOS i686 0.9.128; en-US) AppleWebKit/534.10 (KHTML, like Gecko) Chrome/8.0.552.339');
     $this->assertEquals(['browser' => ['name' => 'Chrome', 'version' => ['major' => 8, 'minor' => 0, 'patch' => 552, 'alias' => null, 'complete' => '8.0.552.339']], 'renderingEngine' => ['name' => null, 'version' => ['major' => null, 'minor' => null, 'patch' => null, 'alias' => null, 'complete' => null]], 'operatingSystem' => ['name' => null, 'version' => ['major' => null, 'minor' => null, 'patch' => null, 'alias' => null, 'complete' => null]], 'device' => ['model' => null, 'brand' => null, 'type' => null, 'isMobile' => null, 'isTouch' => null], 'bot' => ['isBot' => null, 'name' => null, 'type' => null]], $result->toArray());
     /*
      * Test the raw result
      */
     $rawResult = $result->getProviderResultRaw();
     $this->assertEquals(['platform' => 'Chrome OS', 'browser' => 'Chrome', 'version' => '8.0.552.339'], $rawResult);
 }
コード例 #2
0
 /**
  * Browser only
  */
 public function testParseBrowser()
 {
     self::$browser = 'Firefox';
     self::$version = '3.0.1';
     $provider = new DonatjUAParser();
     $result = $provider->parse('A real user agent...');
     // reset
     self::$browser = null;
     self::$version = null;
     $expectedResult = ['browser' => ['name' => 'Firefox', 'version' => ['major' => 3, 'minor' => 0, 'patch' => 1, 'alias' => null, 'complete' => '3.0.1']]];
     $this->assertProviderResult($result, $expectedResult);
 }
コード例 #3
0
 public function testDetectionCapabilities()
 {
     $provider = new DonatjUAParser();
     $this->assertEquals(['browser' => ['name' => true, 'version' => true], 'renderingEngine' => ['name' => false, 'version' => false], 'operatingSystem' => ['name' => false, 'version' => false], 'device' => ['model' => false, 'brand' => false, 'type' => false, 'isMobile' => false, 'isTouch' => false], 'bot' => ['isBot' => false, 'name' => false, 'type' => false]], $provider->getDetectionCapabilities());
 }