PluginProbe
GetResponse Forms by Optin Cat / 1.3.5
GetResponse Forms by Optin Cat v1.3.5
1.3.4 1.3.5 1.3.6 1.3.8 1.3.9 1.4.0 1.4.1 1.4.2 1.5.0 1.5.1 1.5.2 1.5.4 1.5.5 1.5.6 1.5.7 1.5.8 1.6.1 1.6.2 1.6.3 1.7.0 1.7.1 1.7.2 1.8.0 1.8.1 2.0.0 All 36 releases
getresponse / includes / classes / Mobile-Detect / tests / VendorsTest_tmp.php

VendorsTest_tmp.php in GetResponse Forms by Optin Cat 1.3.5, at includes/classes/Mobile-Detect/tests/VendorsTest_tmp.php

89 lines 2.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * @license MIT License https://github.com/serbanghita/Mobile-Detect/blob/master/LICENSE.txt
4 * @link http://mobiledetect.net
5 */
6 class VendorsTest extends PHPUnit_Framework_TestCase
7 {
8 protected $detect;
9 protected static $items;
10
11 public function setUp()
12 {
13 $this->detect = new Mobile_Detect;
14
15 }
16
17 public static function setUpBeforeClass()
18 {
19 //this method could be called multiple times
20 if (!self::$items) {
21 self::$items = include dirname(__FILE__).'/UA_List.inc.php';
22 }
23 }
24
25 public function testisMobileIsTablet()
26 {
27 foreach (self::$items as $brand => $deviceArr) {
28 foreach ($deviceArr as $userAgent => $conditions) {
29 if (!is_array($conditions)) {
30 continue;
31 }
32
33 $this->detect->setUserAgent($userAgent);
34
35 foreach ($conditions as $condition => $assert) {
36 // Currently not supporting version and model here.
37 // @todo: I need to split this tests!
38 if (in_array($condition, array('model'))) {
39 continue;
40 } // 'version',
41
42 switch ($condition) {
43 case 'version':
44 // Android, iOS, Chrome, Build, etc.
45 foreach ($assert as $assertKey => $assertValue) {
46 //if ($brand == 'Apple') {
47 // echo 'UA ('.$condition.'('.$assertKey.') === '.$assertValue.'): '.$userAgent . "\n";
48 //}
49 $this->assertTrue( $this->detect->$condition( $assertKey ) == $assertValue, 'UA ('.$condition.'('.$assertKey.') === '.$assertValue.'): '.$userAgent);
50 }
51 break;
52
53 default:
54 $this->assertTrue($this->detect->$condition() === $assert, 'UA ('.$condition.'): '.$userAgent);
55 break;
56 }
57
58 }
59
60 }
61
62 }
63
64 }
65
66 public function testVersion()
67 {
68 foreach (self::$items as $brand => $deviceArr) {
69
70 foreach ($deviceArr as $userAgent => $conditions) {
71
72 if ( !is_array($conditions) || !isset($conditions['version']) ) { continue; }
73
74 $this->detect->setUserAgent($userAgent);
75
76 foreach ($conditions['version'] as $condition => $assertion) {
77
78 $this->assertEquals( $this->detect->version($condition), $assertion, 'UA (version("'.$condition.'")): '.$userAgent );
79
80 }
81
82 }
83
84 }
85
86 }
87
88 }
89