PHP: ensure 5.3 compatibility, refactor timezone utilities
Relates to #250 Modifications - supported version - bump required version from 5.1.0 to 5.3.x - update README - add PHP 5.3 to Travis environments - rewrite array declarations: explicitely use array() instead of [] - move checkPHPVersion to application/Utils.php - move timezone functions to application/TimeZone.php - cleanup code - improve test coverage Signed-off-by: VirtualTam <virtualtam@flibidi.net>
This commit is contained in:
parent
5b0ebbc5de
commit
d1e2f8e52c
10 changed files with 288 additions and 102 deletions
tests
|
@ -109,7 +109,7 @@ class UtilsTest extends PHPUnit_Framework_TestCase
|
|||
*/
|
||||
public function testGenerateLocationLoop() {
|
||||
$ref = 'http://localhost/?test';
|
||||
$this->assertEquals('?', generateLocation($ref, 'localhost', ['test']));
|
||||
$this->assertEquals('?', generateLocation($ref, 'localhost', array('test')));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -119,4 +119,36 @@ class UtilsTest extends PHPUnit_Framework_TestCase
|
|||
$ref = 'http://somewebsite.com/?test';
|
||||
$this->assertEquals('?', generateLocation($ref, 'localhost'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Check supported PHP versions
|
||||
*/
|
||||
public function testCheckSupportedPHPVersion()
|
||||
{
|
||||
$minVersion = '5.3';
|
||||
checkPHPVersion($minVersion, '5.4.32');
|
||||
checkPHPVersion($minVersion, '5.5');
|
||||
checkPHPVersion($minVersion, '5.6.10');
|
||||
}
|
||||
|
||||
/**
|
||||
* Check a unsupported PHP version
|
||||
* @expectedException Exception
|
||||
* @expectedExceptionMessageRegExp /Your PHP version is obsolete/
|
||||
*/
|
||||
public function testCheckSupportedPHPVersion51()
|
||||
{
|
||||
checkPHPVersion('5.3', '5.1.0');
|
||||
}
|
||||
|
||||
/**
|
||||
* Check another unsupported PHP version
|
||||
* @expectedException Exception
|
||||
* @expectedExceptionMessageRegExp /Your PHP version is obsolete/
|
||||
*/
|
||||
public function testCheckSupportedPHPVersion52()
|
||||
{
|
||||
checkPHPVersion('5.3', '5.2');
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue