-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #84 from TwistPHP/more-travis-tests
Added more travis test, coverage now up to 18%
- Loading branch information
Showing
11 changed files
with
187 additions
and
117 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ php: | |
- 5.6 | ||
env COVERALLS=ON | ||
- 7.0 | ||
- hhvm | ||
# - hhvm | ||
- nightly | ||
|
||
services: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
|
||
class Hooks extends \PHPUnit_Framework_TestCase{ | ||
|
||
public function testGetAllHooks(){ | ||
$this->assertTrue(array_key_exists('TWIST_VIEW_TAG',\Twist::framework()->hooks()->getAll())); | ||
} | ||
|
||
public function testRegisterHook(){ | ||
\Twist::framework()->hooks()->register('travisCI','travis-test-hook','test-hook'); | ||
$this->assertEquals('test-hook',\Twist::framework()->hooks()->get('travisCI','travis-test-hook')); | ||
} | ||
|
||
public function testGetRegisteredHook(){ | ||
$this->assertEquals('test-hook',\Twist::framework()->hooks()->get('travisCI','travis-test-hook')); | ||
} | ||
|
||
public function testCancelRegisteredHook(){ | ||
\Twist::framework()->hooks()->cancel('travisCI','travis-test-hook'); | ||
$this->assertEquals(null,\Twist::framework()->hooks()->get('travisCI','travis-test-hook')); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
|
||
class Tools extends \PHPUnit_Framework_TestCase{ | ||
|
||
public function testTraverseURI(){ | ||
//Need to look at this | ||
$this->assertEquals('/my/test',\Twist::framework()->tools()->traverseURI('./','/my/test/uri')); | ||
$this->assertEquals('/my/test',\Twist::framework()->tools()->traverseURI('../','/my/test/uri')); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
|
||
class UserAgent extends \PHPUnit_Framework_TestCase{ | ||
|
||
public function testGet(){ | ||
$_SERVER['HTTP_USER_AGENT'] = 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.1'; | ||
$this->assertEquals('Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.1',Twist\Core\Models\UserAgent::get()); | ||
} | ||
|
||
public function testDetect(){ | ||
$arrUserAgent = Twist\Core\Models\UserAgent::detect(); | ||
$this->assertEquals('Firefox',$arrUserAgent['browser']['title']); | ||
} | ||
|
||
public function testDeviceType(){ | ||
$this->assertEquals('Desktop',Twist\Core\Models\UserAgent::getDeviceType('win10')); | ||
} | ||
|
||
public function testOS(){ | ||
$arrUserAgent = Twist\Core\Models\UserAgent::getOS('win10'); | ||
$this->assertEquals('Windows 10',$arrUserAgent['version']); | ||
} | ||
|
||
public function testBrowser(){ | ||
$arrUserAgent = Twist\Core\Models\UserAgent::getBrowser('firefox'); | ||
$this->assertEquals('Firefox',$arrUserAgent['title']); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
class CSV extends \PHPUnit_Framework_TestCase{ | ||
|
||
public function testGenerate(){ | ||
|
||
$arrData = array( | ||
0 => array('id' => 1,'name' => 'Dan','description' => 'test desc 1'), | ||
1 => array('id' => 2,'name' => 'Andi','description' => 'test desc 2') | ||
); | ||
|
||
$strCSV = \Twist::CSV()->export(TWIST_UPLOADS.'test.csv',$arrData); | ||
|
||
$this->assertTrue(strstr($strCSV,',') && strstr($strCSV,"\n") && strstr($strCSV,'id')); | ||
} | ||
|
||
public function testImport(){ | ||
|
||
$arrData = \Twist::CSV()->import(TWIST_UPLOADS.'test.csv',"\n",",",'""',"\\",true); | ||
|
||
$this->assertTrue(count($arrData) == 2 && $arrData[0]['id'] == 1 && $arrData[1]['name'] == 'Andi'); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
|
||
class Device extends \PHPUnit_Framework_TestCase{ | ||
|
||
public function testGet(){ | ||
$_SERVER['HTTP_USER_AGENT'] = 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.1'; | ||
$arrDevice = Twist::Device()->get(); | ||
$this->assertEquals('Firefox',$arrDevice['browser']['title']); | ||
} | ||
|
||
public function testGetOS(){ | ||
$this->assertEquals('Windows',Twist::Device()->getOS()); | ||
} | ||
|
||
public function testGetOSVersion(){ | ||
$this->assertEquals('Windows 7',Twist::Device()->getOSVersion()); | ||
} | ||
|
||
public function testGetDevice(){ | ||
$this->assertEquals('Desktop',Twist::Device()->getDevice()); | ||
} | ||
|
||
public function testGetBrowser(){ | ||
$this->assertEquals('Firefox',Twist::Device()->getBrowser()); | ||
} | ||
|
||
} |
Oops, something went wrong.