public function testRealResult() { $provider = new WhichBrowser(); $parser = $provider->getParser(['User-Agent' => 'A real user agent...']); $this->assertInstanceOf('WhichBrowser\\Parser', $parser); /* * test method exists */ $class = new \ReflectionClass($parser); $this->assertTrue($class->hasMethod('isDetected'), 'method isDetected() does not exist anymore'); $this->assertTrue($class->hasMethod('toArray'), 'method toArray() does not exist anymore'); $this->assertTrue($class->hasMethod('getType'), 'method getType() does not exist anymore'); $this->assertTrue($class->hasMethod('isType'), 'method isType() does not exist anymore'); $this->assertTrue($class->hasProperty('browser'), 'property browser does not exist anymore'); $this->assertInstanceOf('WhichBrowser\\Model\\Browser', $parser->browser); $this->assertTrue($class->hasProperty('engine'), 'property engine does not exist anymore'); $this->assertInstanceOf('WhichBrowser\\Model\\Engine', $parser->engine); $this->assertTrue($class->hasProperty('os'), 'property os does not exist anymore'); $this->assertInstanceOf('WhichBrowser\\Model\\Os', $parser->os); $this->assertTrue($class->hasProperty('device'), 'property device does not exist anymore'); $this->assertInstanceOf('WhichBrowser\\Model\\Device', $parser->device); }
public function testParser() { $provider = new WhichBrowser(); $this->assertInstanceOf('WhichBrowser\\Parser', $provider->getParser([])); }