This repository was archived by the owner on Dec 3, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathBrowscapTest.php
More file actions
86 lines (69 loc) · 2.29 KB
/
Copy pathBrowscapTest.php
File metadata and controls
86 lines (69 loc) · 2.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<?php
namespace Browscap\BrowscapBundle\Tests;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
use Symfony\Component\Filesystem\Filesystem;
class BrowscapTest extends WebTestCase
{
protected static function createKernel(array $options = array())
{
$env = @$options['env'] ?: 'test';
return new AppKernel($env, true);
}
protected function setUp()
{
$fs = new Filesystem();
$fs->remove(sys_get_temp_dir().'/BrowscapBundle/');
}
protected function tearDown()
{
static::$kernel = null;
}
public function testService() {
$client = static::createClient();
$bc = $client->getContainer()->get('browscap');
$this->assertInstanceOf('Browscap\BrowscapBundle\Browscap', $bc);
}
/**
* @dataProvider getBrowsers
*/
public function testBrowsers($browser, array $expected) {
$client = static::createClient();
$bc = $client->getContainer()->get('browscap');
$result = $bc->getBrowser($browser, true);
foreach ($expected as $key => $value) {
$this->assertEquals($value, $result[$key]);
}
}
/**
* Data Provider for testBrowsers
*/
public function getBrowsers() {
return array(
array(
'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:25.0) Gecko/20100101 Firefox/24.0',
array(
'Parent' => 'Firefox 24.0',
'Platform' => 'Ubuntu',
'CssVersion' => 3,
),
),
array(
'Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)',
array(
'Parent' => 'IE 10.0 for Desktop',
'Platform' => 'Win7',
'CssVersion' => 3,
),
),
array(
'Mozilla/5.0 (Linux; U; Android 4.0.3; ko-kr; LG-L160L Build/IML74K) AppleWebkit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30',
array(
'Parent' => 'Android Browser 4.0',
'Platform' => 'Android',
'CssVersion' => 3,
'isMobileDevice' => true,
),
),
);
}
}