Skip to content

Commit c0e22a4

Browse files
committed
Added basic tests.
1 parent 0c66270 commit c0e22a4

File tree

3 files changed

+23
-4
lines changed

3 files changed

+23
-4
lines changed

.travis.yml

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
language: php
22
php:
3-
- "5.4"
4-
- "5.3"
53
- "5.2"
64

75
branches:

tests/BasicsTest.php

+19-1
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,29 @@
11
<?php
22
class BasicTest extends PHPUnit_Framework_TestCase {
33

4+
protected function setUp(){
5+
6+
$this->detect = new Mobile_Detect;
7+
8+
}
9+
410
public function testClassExists(){
511

6-
$detect = new Mobile_Detect;
712
$this->assertTrue(class_exists('Mobile_Detect'));
813

914
}
1015

16+
public function testBasicMethods(){
17+
18+
$this->detect->setUserAgent('Mozilla/5.0 (iPhone; CPU iPhone OS 6_0_1 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A523 Safari/8536.25');
19+
20+
$this->assertTrue( $this->detect->isMobile() );
21+
$this->assertFalse( $this->detect->isTablet() );
22+
$this->assertTrue( $this->detect->isIphone() );
23+
$this->assertTrue( $this->detect->isiOS() );
24+
$this->assertTrue( $this->detect->is('iphone') );
25+
$this->assertTrue( $this->detect->is('ios') );
26+
27+
}
28+
1129
}

tests/bootstrap.php

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
<?php
2+
/*
23
function __autoload($className){
34
$dirs = array('/../');
45
foreach($dirs as $dir){
56
require_once dirname(__FILE__).$dir.$className.'.php';
67
}
78
8-
}
9+
}
10+
*/
11+
require_once dirname(__FILE__).'/../Mobile_Detect.php';

0 commit comments

Comments
 (0)