6
6
$ tests = array (
7
7
// Namoroka Ubuntu
8
8
'Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2pre) Gecko/20100116 Ubuntu/9.10 (karmic) Namoroka/3.6pre '
9
- => array ('firefox ' , '3.6 ' , 'linux ' ),
9
+ => array ('firefox ' , '3.6 ' , 'linux ' , ' gecko ' ),
10
10
11
11
// Namoroka Mac
12
12
'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2) Gecko/20100105 Firefox/3.6 '
13
- => array ('firefox ' , '3.6 ' , 'macintosh ' ),
13
+ => array ('firefox ' , '3.6 ' , 'macintosh ' , ' gecko ' ),
14
14
15
15
// Chrome Mac
16
16
'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_2; fr-fr) AppleWebKit/531.21.8 (KHTML, like Gecko) Version/4.0.4 Safari/531.21.10 '
17
- => array ('chrome ' , '4.0 ' , 'macintosh ' ),
17
+ => array ('chrome ' , '4.0 ' , 'macintosh ' , ' webkit ' ),
18
18
19
19
//Safari Mac
20
20
'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_2; fr-fr) AppleWebKit/531.21.8 (KHTML, like Gecko) Version/4.0.4 Safari/531.21.10 '
21
- => array ('safari ' , '4.0 ' , 'macintosh ' ),
21
+ => array ('safari ' , '4.0 ' , 'macintosh ' , ' webkit ' ),
22
22
23
23
// Opera 9 Windows
24
24
'Opera/9.61 (Windows NT 6.0; U; en) Presto/2.1.1 '
25
- => array ('opera ' , '9.61 ' , 'windows ' ),
25
+ => array ('opera ' , '9.61 ' , 'windows ' , ' presto ' ),
26
26
27
27
// Opera 10 Windows
28
28
'Opera/9.80 (Windows NT 5.1; U; en) Presto/2.2.15 Version/10.10 '
29
- => array ('opera ' , '10.10 ' , 'windows ' ),
29
+ => array ('opera ' , '10.10 ' , 'windows ' , ' presto ' ),
30
30
31
31
// Firefox Linux
32
32
'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.17) Gecko/2010010604 Linux Mint/7 (Gloria) Firefox/3.0.17 '
33
- => array ('firefox ' , '3.0 ' , 'linux ' ),
33
+ => array ('firefox ' , '3.0 ' , 'linux ' , ' gecko ' ),
34
34
35
35
// Firefox Windows
36
36
'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-GB; rv:1.9.1.7) Gecko/20091221 Firefox/3.5.7 GTB6 (.NET CLR 3.5.30729) '
37
- => array ('firefox ' , '3.5 ' , 'windows ' ),
37
+ => array ('firefox ' , '3.5 ' , 'windows ' , ' gecko ' ),
38
38
39
39
// Firefox OSX
40
40
'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.1.8) Gecko/20100202 Firefox/3.5.8 '
41
- => array ('firefox ' , '3.5 ' , 'macintosh ' ),
41
+ => array ('firefox ' , '3.5 ' , 'macintosh ' , ' gecko ' ),
42
42
43
43
// Chrome Linux
44
44
'Mozilla/5.0 (X11; U; Linux i686; en-US) AppleWebKit/532.5 (KHTML, like Gecko) Chrome/4.0.249.43 Safari/532.5 '
45
- => array ('chrome ' , '4.0 ' , 'linux ' ),
45
+ => array ('chrome ' , '4.0 ' , 'linux ' , ' webkit ' ),
46
46
47
47
// Speedy Spider
48
48
'Speedy Spider (http://www.entireweb.com/about/search_tech/speedy_spider/) '
49
- => array (null , null , null ),
49
+ => array (null , null , null , null ),
50
50
51
51
// Minefield Mac
52
52
'Gecko 20100113Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.3a1pre) Gecko/20100113 Minefield/3.7a1pre '
53
- => array ('firefox ' , '3.7 ' , 'macintosh ' ),
53
+ => array ('firefox ' , '3.7 ' , 'macintosh ' , ' gecko ' ),
54
54
55
55
// IE7 Windows
56
56
'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; Trident/4.0; GTB6; SLCC1; .NET CLR 2.0.50727; OfficeLiveConnector.1.3; OfficeLivePatch.0.0; .NET CLR 3.5.30729; InfoPath.2; .NET CLR 3.0.30729; MSOffice 12) '
57
- => array ('msie ' , '7.0 ' , 'windows ' ),
57
+ => array ('msie ' , '7.0 ' , 'windows ' , ' trident ' ),
58
58
59
59
// IE6 Windows
60
60
'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; DigExt) '
61
- => array ('msie ' , '6.0 ' , 'windows ' ),
61
+ => array ('msie ' , '6.0 ' , 'windows ' , ' trident ' ),
62
62
63
63
// Feedfetcher Google
64
64
'Feedfetcher-Google; (+http://www.google.com/feedfetcher.html; 2 subscribers; feed-id=6924676383167400434) '
65
- => array (null , null , null ),
65
+ => array (null , null , null , null ),
66
66
67
67
// Google Bot
68
68
'Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html) '
69
- => array ('googlebot ' , '2.1 ' , null ),
69
+ => array ('googlebot ' , '2.1 ' , null , null ),
70
70
71
71
// MSN Bot
72
72
'msnbot/2.0b (+http://search.msn.com/msnbot.htm) '
73
- => array ('msnbot ' , '2.0 ' , null ),
73
+ => array ('msnbot ' , '2.0 ' , null , null ),
74
74
75
75
// Yahoo Bot
76
76
'Mozilla/5.0 (compatible; Yahoo! Slurp; http://help.yahoo.com/help/us/ysearch/slurp) '
77
- => array ('yahoobot ' , null , null ),
77
+ => array ('yahoobot ' , null , null , null ),
78
78
79
79
// Iphone
80
80
'Mozilla/5.0 (iPhone; U; CPU iPhone OS 3_1_2 like Mac OS X; de-de) AppleWebKit/528.18 (KHTML, like Gecko) Mobile/7D11 '
81
- => array ('applewebkit ' , '528.18 ' , 'iphone ' )
81
+ => array ('applewebkit ' , '528.18 ' , 'iphone ' , ' webkit ' )
82
82
);
83
83
84
84
$ t = new lime_test (count ($ tests ));
91
91
'string ' => $ parser ->cleanUserAgentString ($ userAgentString ),
92
92
'browser_name ' => $ userAgentArray [0 ],
93
93
'browser_version ' => $ userAgentArray [1 ],
94
- 'operating_system ' => $ userAgentArray [2 ]
94
+ 'operating_system ' => $ userAgentArray [2 ],
95
+ 'engine ' => $ userAgentArray [3 ]
95
96
);
96
97
97
98
$ result = $ parser ->parse ($ userAgentString );
98
99
99
- $ t ->is_deeply ($ parser -> parse ( $ userAgentString ) , $ expected , $ userAgentString .' -> ' .implode (', ' , $ result ));
100
- }
100
+ $ t ->is_deeply ($ result , $ expected , $ userAgentString .' -> ' .implode (', ' , $ result ));
101
+ }
0 commit comments