See also: https://github.com/woothee/woothee-php
Author: Martin Keckeis (martin.keckeis1@gmail.com)
Inheritance: extends AbstractProvider
Exemplo n.º 1
0
 /**
  * Device only
  */
 public function testParseDeviceMobilephone()
 {
     $parser = $this->getParser(['category' => \Woothee\DataSet::DATASET_CATEGORY_MOBILEPHONE, 'name' => \Woothee\DataSet::VALUE_UNKNOWN]);
     $provider = new Woothee();
     $provider->setParser($parser);
     $result = $provider->parse('A real user agent...');
     $expectedResult = ['browser' => ['name' => null, 'version' => ['major' => null, 'minor' => null, 'patch' => null, 'alias' => null, 'complete' => null]], 'device' => ['model' => null, 'brand' => null, 'type' => 'mobilephone', 'isMobile' => true, 'isTouch' => null]];
     $this->assertProviderResult($result, $expectedResult);
 }
Exemplo n.º 2
0
 public function testRealResultDevice()
 {
     $provider = new Woothee();
     $result = $provider->parse('Mozilla/5.0 (iPhone; CPU iPhone OS 5_0 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9A334 Safari/7534.48.3');
     $this->assertEquals(['browser' => ['name' => 'Safari', 'version' => ['major' => 5, 'minor' => 1, 'patch' => null, 'alias' => null, 'complete' => '5.1']], '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' => 'smartphone', 'isMobile' => null, 'isTouch' => null], 'bot' => ['isBot' => null, 'name' => null, 'type' => null]], $result->toArray());
 }
Exemplo n.º 3
0
 public function testParser()
 {
     $provider = new Woothee();
     $this->assertInstanceOf('Woothee\\Classifier', $provider->getParser());
 }