Completed
Branch 3.0.0 (1f43e9)
by Serhii
03:00
created

RobotTest::test1470Bot()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 5

Duplication

Lines 9
Ratio 100 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 5
c 1
b 0
f 0
nc 1
nop 0
dl 9
loc 9
rs 9.6666
1
<?php
2
/**
3
 * @author Sergey Nehaenko <[email protected]>
4
 * @license GPL
5
 * @copyright Sergey Nehaenko &copy 2016
6
 * @version 1.0
7
 * @project browser-detector
8
 */
9
10
namespace EndorphinStudio\Tests;
11
12
13
class RobotTest extends \PHPUnit_Framework_TestCase
14
{
15
16
    /**
17
     * Test Tine RSS
18
     */
19 View Code Duplication
    public function testTinyRSS()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
20
    {
21
        $ualist = array(
22
            'Tiny Tiny RSS/1.10 (http://tt-rss.org/)'
23
        );
24
25
        testUaList($this,'Robot','Name',$ualist,'Tiny RSS');
26
        testUaList($this,'Robot','Type',$ualist,'RSS Reader');
27
    }
28
    /**
29
     * Test Google Bots
30
     */
31 View Code Duplication
    public function testGoogleBot()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
32
    {
33
        $ualist = array(
34
            'Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)',
35
            'Googlebot/2.1 (+http://www.google.com/bot.html)',
36
            'Googlebot-News',
37
            'Googlebot-Image/1.0',
38
            'Googlebot-Video/1.0',
39
            'SAMSUNG-SGH-E250/1.0 Profile/MIDP-2.0 Configuration/CLDC-1.1 UP.Browser/6.2.3.3.c.1.101 (GUI) MMP/2.0 (compatible; Googlebot-Mobile/2.1; +http://www.google.com/bot.html)',
40
            'DoCoMo/2.0 N905i(c100;TB;W24H16) (compatible; Googlebot-Mobile/2.1; +http://www.google.com/bot.html)',
41
            'Mozilla/5.0 (Linux; Android 6.0.1; Nexus 5X Build/MMB29P) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.96 Mobile Safari/537.36 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)',
42
            '(compatible; Mediapartners-Google/2.1; +http://www.google.com/bot.html)',
43
            'Mediapartners-Google'
44
        );
45
46
        testUaList($this,'Robot','Owner',$ualist,'Google Inc.');
47
        testUaList($this,'Robot','Type',$ualist,'Search Engine');
48
        testUaListBooleanTrue($this,'Robot','SearchEngine',$ualist);
49
    }
50
    /**
51
     * Test Yandex Bots
52
     */
53
    public function testYandexBot()
54
    {
55
        $ualist = array(
56
            'Mozilla/5.0 (compatible; YandexBot/3.0; +http://yandex.com/bots) ',
57
            'Mozilla/5.0 (iPhone; CPU iPhone OS 8_1 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Version/8.0 Mobile/12B411 Safari/600.1.4 (compatible; YandexBot/3.0; +http://yandex.com/bots)',
58
            'Mozilla/5.0 (compatible; YandexAccessibilityBot/3.0; +http://yandex.com/bots)',
59
            'Mozilla/5.0 (iPhone; CPU iPhone OS 8_1 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Version/8.0 Mobile/12B411 Safari/600.1.4 (compatible; YandexMobileBot/3.0; +http://yandex.com/bots)',
60
            'Mozilla/5.0 (compatible; YandexDirectDyn/1.0; +http://yandex.com/bots',
61
            'Mozilla/5.0 (compatible; YandexScreenshotBot/3.0; +http://yandex.com/bots)',
62
            'Mozilla/5.0 (compatible; YandexImages/3.0; +http://yandex.com/bots)',
63
            'Mozilla/5.0 (compatible; YandexVideo/3.0; +http://yandex.com/bots)',
64
            'Mozilla/5.0 (compatible; YandexMedia/3.0; +http://yandex.com/bots)',
65
            'Mozilla/5.0 (compatible; YandexBlogs/0.99; robot; +http://yandex.com/bots)',
66
            'Mozilla/5.0 (compatible; YandexFavicons/1.0; +http://yandex.com/bots)',
67
            'Mozilla/5.0 (compatible; YandexWebmaster/2.0; +http://yandex.com/bots)',
68
            'Mozilla/5.0 (compatible; YandexPagechecker/1.0; +http://yandex.com/bots)',
69
            'Mozilla/5.0 (compatible; YandexImageResizer/2.0; +http://yandex.com/bots)',
70
            'Mozilla/5.0 (compatible; YandexAdNet/1.0; +http://yandex.com/bots)',
71
            'Mozilla/5.0 (compatible; YandexDirect/3.0; +http://yandex.com/bots)',
72
            'Mozilla/5.0 (compatible; YaDirectFetcher/1.0; Dyatel; +http://yandex.com/bots)',
73
            'Mozilla/5.0 (compatible; YandexCalendar/1.0; +http://yandex.com/bots)',
74
            'Mozilla/5.0 (compatible; YandexSitelinks; Dyatel; +http://yandex.com/bots)',
75
            'Mozilla/5.0 (compatible; YandexMetrika/2.0; +http://yandex.com/bots)',
76
            'Mozilla/5.0 (compatible; YandexNews/3.0; +http://yandex.com/bots)',
77
            'Mozilla/5.0 (compatible; YandexNewslinks; +http://yandex.com/bots)',
78
            'Mozilla/5.0 (compatible; YandexCatalog/3.0; +http://yandex.com/bots)',
79
            'Mozilla/5.0 (compatible; YandexAntivirus/2.0; +http://yandex.com/bots)',
80
            'Mozilla/5.0 (compatible; YandexMarket/1.0; +http://yandex.com/bots)',
81
            'Mozilla/5.0 (compatible; YandexVertis/3.0; +http://yandex.com/bots)',
82
            'Mozilla/5.0 (compatible; YandexForDomain/1.0; +http://yandex.com/bots)',
83
            'Mozilla/5.0 (compatible; YandexBot/3.0; MirrorDetector; +http://yandex.com/bots)',
84
            'Mozilla/5.0 (compatible; YandexSpravBot/1.0; +http://yandex.com/bots)'
85
        );
86
87
        testUaList($this,'Robot','Owner',$ualist,'Yandex LLC.');
88
        testUaList($this,'Robot','Type',$ualist,'Search Engine');
89
        testUaListBooleanTrue($this,'Robot','SearchEngine',$ualist);
90
    }
91
    /**
92
     * Test Bing Bots
93
     */
94 View Code Duplication
    public function testBingBot()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
95
    {
96
        $ualist = array(
97
            'Mozilla/5.0 (compatible; bingbot/2.0; +http://www.bing.com/bingbot.htm)',
98
            'Mozilla/5.0 (iPhone; CPU iPhone OS 7_0 like Mac OS X) AppleWebKit/537.51.1 (KHTML, like Gecko) Version/7.0 Mobile/11A465 Safari/9537.53 (compatible; bingbot/2.0; +http://www.bing.com/bingbot.htm)',
99
            'Mozilla/5.0 (Windows Phone 8.1; ARM; Trident/7.0; Touch; rv:11.0; IEMobile/11.0; NOKIA; Lumia 530) like Gecko (compatible; bingbot/2.0; +http://www.bing.com/bingbot.htm)',
100
            'msnbot/2.0b (+http://search.msn.com/msnbot.htm)',
101
            'msnbot-media/1.1 (+http://search.msn.com/msnbot.htm)',
102
            'Mozilla/5.0 (compatible; adidxbot/2.0; +http://www.bing.com/bingbot.htm)',
103
            'Mozilla/5.0 (iPhone; CPU iPhone OS 7_0 like Mac OS X) AppleWebKit/537.51.1 (KHTML, like Gecko) Version/7.0 Mobile/11A465 Safari/9537.53 (compatible; adidxbot/2.0; +http://www.bing.com/bingbot.htm)',
104
            'Mozilla/5.0 (Windows Phone 8.1; ARM; Trident/7.0; Touch; rv:11.0; IEMobile/11.0; NOKIA; Lumia 530) like Gecko (compatible; adidxbot/2.0; +http://www.bing.com/bingbot.htm)',
105
            'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/534+ (KHTML, like Gecko) BingPreview/1.0b',
106
            'Mozilla/5.0 (Windows Phone 8.1; ARM; Trident/7.0; Touch; rv:11.0; IEMobile/11.0; NOKIA; Lumia 530) like Gecko BingPreview/1.0b'
107
        );
108
109
        testUaList($this,'Robot','Name',$ualist,'Bing');
110
        testUaList($this,'Robot','Type',$ualist,'Search Engine');
111
        testUaListBooleanTrue($this,'Robot','SearchEngine',$ualist);
112
    }
113
    /**
114
     * Test WASALive
115
     */
116 View Code Duplication
    public function testWasaLiveBot()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
117
    {
118
        $ualist = array(
119
            'Mozilla/5.0 (compatible; WASALive-Bot ; http://blog.wasalive.com/wasalive-bots/) '
120
        );
121
122
        testUaList($this,'Robot','Name',$ualist,'WASALive Bot');
123
        testUaList($this,'Robot','Type',$ualist,'Bot/Crawler');
124
    }
125
    /**
126
     * Test .Net robot
127
     */
128 View Code Duplication
    public function testDotNetBot()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
129
    {
130
        $ualist = array(
131
            'MS Web Services Client Protocol 1.0.3705.0'
132
        );
133
134
        testUaList($this,'Robot','Name',$ualist,'.NET Framework CLR');
135
        testUaList($this,'Robot','Type',$ualist,'Bot/Crawler');
136
    }
137
    /**
138
     * Test 007ac9 robot
139
     */
140 View Code Duplication
    public function test007ac9Bot()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
141
    {
142
        $ualist = array(
143
            'Mozilla/5.0 (compatible; 007ac9 Crawler; http://crawler.007ac9.net/) '
144
        );
145
146
        testUaList($this,'Robot','Name',$ualist,'007ac9 Crawler');
147
        testUaList($this,'Robot','Type',$ualist,'Bot/Crawler');
148
    }
149
    /**
150
     * Test 80legs robot
151
     */
152 View Code Duplication
    public function test80legsBot()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
153
    {
154
        $ualist = array(
155
            'Mozilla/5.0 (compatible; 008/0.83; http://www.80legs.com/webcrawler.html) Gecko/2008032620 '
156
        );
157
158
        testUaList($this,'Robot','Name',$ualist,'80legs Crawler');
159
        testUaList($this,'Robot','Type',$ualist,'Bot/Crawler');
160
    }
161
    /**
162
     * Test 80123metaspider robot
163
     */
164 View Code Duplication
    public function test123metaspiderBot()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
165
    {
166
        $ualist = array(
167
            '123metaspider-Bot (Version: 1.04, powered by www.123metaspider.com) '
168
        );
169
170
        testUaList($this,'Robot','Name',$ualist,'123metaspider Crawler');
171
        testUaList($this,'Robot','Type',$ualist,'Bot/Crawler');
172
    }
173
    /**
174
     * Test 1470 robot
175
     */
176 View Code Duplication
    public function test1470Bot()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
177
    {
178
        $ualist = array(
179
            '1470.net crawler '
180
        );
181
182
        testUaList($this,'Robot','Name',$ualist,'1470 Crawler');
183
        testUaList($this,'Robot','Type',$ualist,'Bot/Crawler');
184
    }
185
}
186