@@ -2,39 +2,39 @@ |
||
| 2 | 2 | |
| 3 | 3 | class UserAgentTest extends PHPUnit_Framework_TestCase |
| 4 | 4 | { |
| 5 | - protected $CrawlerDetect; |
|
| 5 | + protected $CrawlerDetect; |
|
| 6 | 6 | |
| 7 | - public function setUp() |
|
| 8 | - { |
|
| 9 | - $this->CrawlerDetect = new Jaybizzle\CrawlerDetect\CrawlerDetect(); |
|
| 10 | - } |
|
| 7 | + public function setUp() |
|
| 8 | + { |
|
| 9 | + $this->CrawlerDetect = new Jaybizzle\CrawlerDetect\CrawlerDetect(); |
|
| 10 | + } |
|
| 11 | 11 | |
| 12 | - public function testBots() |
|
| 13 | - { |
|
| 14 | - $lines = file(__DIR__.'/crawlers.txt', FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); |
|
| 12 | + public function testBots() |
|
| 13 | + { |
|
| 14 | + $lines = file(__DIR__.'/crawlers.txt', FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); |
|
| 15 | 15 | |
| 16 | - foreach ($lines as $line) { |
|
| 17 | - $test = $this->CrawlerDetect->isCrawler($line); |
|
| 18 | - $this->assertEquals($test, true, $line); |
|
| 19 | - } |
|
| 20 | - } |
|
| 16 | + foreach ($lines as $line) { |
|
| 17 | + $test = $this->CrawlerDetect->isCrawler($line); |
|
| 18 | + $this->assertEquals($test, true, $line); |
|
| 19 | + } |
|
| 20 | + } |
|
| 21 | 21 | |
| 22 | - public function testDevices() |
|
| 23 | - { |
|
| 24 | - $lines = file(__DIR__.'/devices.txt', FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); |
|
| 22 | + public function testDevices() |
|
| 23 | + { |
|
| 24 | + $lines = file(__DIR__.'/devices.txt', FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); |
|
| 25 | 25 | |
| 26 | - foreach ($lines as $line) { |
|
| 27 | - $test = $this->CrawlerDetect->isCrawler($line); |
|
| 28 | - $this->assertEquals($test, false, $line); |
|
| 29 | - } |
|
| 30 | - } |
|
| 26 | + foreach ($lines as $line) { |
|
| 27 | + $test = $this->CrawlerDetect->isCrawler($line); |
|
| 28 | + $this->assertEquals($test, false, $line); |
|
| 29 | + } |
|
| 30 | + } |
|
| 31 | 31 | |
| 32 | - public function testReturnsCorrectMatchedBotName() |
|
| 33 | - { |
|
| 34 | - $test = $this->CrawlerDetect->isCrawler('Mozilla/5.0 (iPhone; CPU iPhone OS 7_1 like Mac OS X) AppleWebKit (KHTML, like Gecko) Mobile (compatible; Yahoo Ad monitoring; https://help.yahoo.com/kb/yahoo-ad-monitoring-SLN24857.html)'); |
|
| 32 | + public function testReturnsCorrectMatchedBotName() |
|
| 33 | + { |
|
| 34 | + $test = $this->CrawlerDetect->isCrawler('Mozilla/5.0 (iPhone; CPU iPhone OS 7_1 like Mac OS X) AppleWebKit (KHTML, like Gecko) Mobile (compatible; Yahoo Ad monitoring; https://help.yahoo.com/kb/yahoo-ad-monitoring-SLN24857.html)'); |
|
| 35 | 35 | |
| 36 | - $matches = $this->CrawlerDetect->getMatches(); |
|
| 36 | + $matches = $this->CrawlerDetect->getMatches(); |
|
| 37 | 37 | |
| 38 | - $this->assertEquals($this->CrawlerDetect->getMatches(), 'Yahoo Ad monitoring', $matches); |
|
| 39 | - } |
|
| 38 | + $this->assertEquals($this->CrawlerDetect->getMatches(), 'Yahoo Ad monitoring', $matches); |
|
| 39 | + } |
|
| 40 | 40 | } |