Inheritance: extends AbstractProvider
コード例 #1
0
 /**
  * This test makes sure, that the chain provider stops when a result is found
  */
 public function testRealResultThreeProviderSecondUsed()
 {
     $provider = new Chain([new Zsxsoft(), new PiwikDeviceDetector(), new WhichBrowser()]);
     $result = $provider->parse('Googlebot/2.1 (+http://www.google.com/bot.html)');
     // Zsxsoft cannot detect bots!
     $this->assertTrue($result->getBot()->getIsBot());
     // WhichBrowser cannot detect the bot type
     $this->assertEquals('Search bot', $result->getBot()->getType());
 }
コード例 #2
0
 public function testParseWithProviderAndValidResult()
 {
     $resultMock = $this->getMock('UserAgentParser\\Model\\UserAgent');
     $provider = $this->provider;
     $provider->expects($this->any())->method('parse')->will($this->returnValue($resultMock));
     $chain = new Chain([$provider]);
     $userAgent = 'Googlebot/2.1 (http://www.googlebot.com/bot.html)';
     $this->assertSame($resultMock, $chain->parse($userAgent));
 }