From d1e2f8e52c931f84c11d4f54f32959710d528182 Mon Sep 17 00:00:00 2001 From: VirtualTam Date: Sat, 11 Jul 2015 01:29:12 +0200 Subject: 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 --- tests/UtilsTest.php | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) (limited to 'tests/UtilsTest.php') diff --git a/tests/UtilsTest.php b/tests/UtilsTest.php index 8355c7f8..28e15f5a 100644 --- a/tests/UtilsTest.php +++ b/tests/UtilsTest.php @@ -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'); + } } +?> -- cgit v1.2.3