getParser() public method

public getParser ( ) : UAParser\Parser
return UAParser\Parser
Ejemplo n.º 1
0
 public function testParser()
 {
     $parser = $this->getParser();
     $provider = new UAParser();
     $provider->setParser($parser);
     $this->assertSame($parser, $provider->getParser());
     $provider->setParser(null);
     $this->assertInstanceOf('UAParser\\Parser', $provider->getParser());
 }
Ejemplo n.º 2
0
 public function testParseResult()
 {
     $provider = new UAParser($this->getParser());
     $parser = $provider->getParser();
     /* @var $result \UAParser\Result\Client */
     $result = $parser->parse('A real user agent...');
     $this->assertInstanceOf('UAParser\\Result\\Client', $result);
     $class = new \ReflectionClass($result);
     $this->assertTrue($class->hasProperty('ua'), 'property ua does not exist anymore');
     $this->assertInstanceOf('UAParser\\Result\\UserAgent', $result->ua);
     $this->assertTrue($class->hasProperty('os'), 'property os does not exist anymore');
     $this->assertInstanceOf('UAParser\\Result\\OperatingSystem', $result->os);
     $this->assertTrue($class->hasProperty('device'), 'property os does not exist anymore');
     $this->assertInstanceOf('UAParser\\Result\\Device', $result->device);
 }